Following discussion on #455, this removes RectClip from our API, as it does not provide the same guarantees that Clipper2's regular boolean clipping operations give us (that make sure that CrossSections can be extruded successfully).
Also, this fixes AsCrossSection which was returning empty CrossSections due to incorrect winding followed by a Positive fill rule union operation. Now it is working as advertised, while skipping over the needless clipping by implementing it as a CrossSection constructor (building a PathsD directly).
- add CrossSection class
- move static method (constructors) under their respective classes
-add Manifold.{split, splitByPlane}
- enable usage of instanceof on Manifold (and now CrossSection) objects simplify registry indirection in worker.ts, enabling method de-structuring (opening static function names out of class module name-spaces)
Build changes:
- break C++ helpers out from bindings.cpp to helpers.cpp
- ensure that ts files are copied during builds even when nothing is recompiled
Note that in addition to the new bindings, the most of the existing toplevel functions have been moved under their respective classes as static methods (breaking change!). I haven't added any new examples yet, but the existing ones are passing and do make use of CrossSection now (some transparently, and some directly), but I think enough of this is together that review is worthwhile.
* js binding for triangulation
* don't use CrossSection class as it alters the order of the vertices
* remove unused code,
rename original Triangulate to TriangulateIdx,
move TriangulateJS from bindings.cpp to polygon.cpp,
rename TrinagulateJS to Triangulate for consistent C++ and JS API,
add optional precision parameter
Add `InvalidConstruction` to `Manifold::Error` and return empty manifolds with it set when manifold construction is attempted with invalid parameters
- zero / negative dimensions for Cube
- zero / negative radius for Sphere
- zero / negative height for Extrude
- empty CrossSection for Extrude/Revolve
Also, Circle and Square have been updated to return empty CrossSections for similar arguments.
* WIP Clipper2 wrapper for 2d subsystem
* Working example in clippoly_test
* Add clean_ property to clippoly
* Square center=false by default
* Square defaults to center=false
* Shorten union example
* + simplification and minkowski functions
* + Circle and note on Minkowski
* + Offset (InflatePaths)
* Clippoly -> CrossSection renaming
* Switch from NonZero to Positive fill rule
* -(minkowski, simplifs, clean_) + pre-alloc vecs
Remove minkowski, simplification algorithms other than simplify,
clean (union) arbitrary contours on construction, and pre-allocate
vectors when length is known.
* - index from polygon conversion + missed vec prealloc
* Use Polygon shorthand over std::vector
* Update copyright date
* Add Rotate
* Update copyrights to 2023
* Extrude and Revolve accept CrossSection only
* Fix incorrect use of vector constructor
* Fix remaining incorrect vector construction
* Revert "Update copyrights to 2023"
This reverts commit af8f6c8c95135eb3376e1f150fe720fddea16f33.
* Re-update copyright notice in cross_section files
* Add missing precision_ argument to cleaning Unions
* Lift circular resolution globals into Quality
* Replace uses of Manifold globals with Quality
* + Ellipse, Mirror, Area
* Include mirror in Union example and test area
* + Rewind (reverse winding of all contours)
* + fillrule/IsEmpty - Ellipse/Rewind
* Move Quality into public.h
* Remove bad definition
* Replace manual circles with CrossSection::Circle
* Lists of empty contours are empty
* + Rect class, RectClip, + const params/methods
* Add Transform to CrossSection and Rect
* es6 tests work
* fixed model-viewer example
* fixed three example
* worker not quite working
* removed three.js dependency
* switched to top-level await
* added normalIdx binding
* fix binding
* Added missing JS bindings (from discussion in #317)
* Fix formatting
* Add reserveIDs JS bindings
* Use numRun instead of numMatrix
* Make numProp, triVerts and vertProperties required options in Mesh ctor.
* Rename MeshJS originalID to runOriginalID, and transform to runTransform
* Fix formatting with clang-format
* Trigger CI
* Added missing C bindings
* Rename matrix to transform in JS type definitions
* Rename numMatrix to numRun in JS type defs
almost forgot this one again
* JS bindings, transform index -> run
* removed BufferGeometryUtils
* replaced three.js with gltf-transform
* textured sphere working
* added cubeUV
* added textures
* added relation and sorting to MeshGL
* working textures example!
* added faceID
* removed MeshRelation
* some more removal
* fix output for no properties
* test cleanup
* Add new MeshGL accessors (replacing MeshRelation) (#311)
+ new meshgl accessors + remove mesh_relation_size
* removed meshID from public API
* added input checking for MeshGL
* remove C api
---------
Co-authored-by: Geoff deRosenroll <geoffderosenroll@gmail.com>
* figure out wasm shared memory access, manifold data structure storage
* checkpoint multi-mode mesh direct access
* clean this up for a PR
* use size_t instead of int. fix pointer math for free() call. tab indent 2 spaces in js to match other code
* apply clang formatting. default to mode 1 (faster)
* eliminate new getMeshDirect() api call and fold it into getMesh() as an optional parameter object
eliminate _FreeMeshDirect and use Module._free() instead
* added optional ability to get normals array
restore access to mode 0 largely for testing
* remove mode options, simplify code
* this is quite a bit neater. fixes shorter header length
* attempt to do this the right way
* meshGL working
* revert JS API update
* added docs
Co-authored-by: Stewart Allen <stewart.allen@gmail.com>
* expose batch boolean API
It is common to perform boolean operations on a set of meshes. This
batch boolean API allows faster operation in that case by avoiding
building up a complicated csg tree.
* expose batch boolean interface for wasm
This brings a 10x improvement to browser in some cases.
See #215 for discussion.
* record performance statistics for editor
So we can compare against other libraries easily, and users are able to
verify it without having to compile the whole library. Ideally we should
put this information in a console GUI, but printing to browser console
works for now.