Comments (9)
I think Clipper2 is worth considering for wrapping. OpenSCAD actually uses Clipper1 (v6.4.2) for its 2D booleans with a small utility translation layer. Evolving out of Clipper1 it's pretty well used, and has benefitted from recent improvements.
from manifold.
I think I can just implement it for TypeScript now, other users can implement their own wrapper as this is not complicated. Eventually we should use something like Clipper2, but it will take some time and I prefer having something that works first (kind of sick writing custom polygon generation code...)
from manifold.
from manifold.
Thinking about this recently, I wonder if we really need a 2D subsystem at all (for now). I think we can just write a simple wrapper to convert to3D(2D op 2D)
to to3D(2D) op to3D(2D)
, e.g. extrude(LargeSquare - SmallSquare, n)
to extrude(LargeSquare, n) - extrude(SmallSquare, n)
. This method will be slower than using a 2D subsystem, but it is really simple and I think our performance is good enough that the users will probably not notice this.
from manifold.
That's a clever idea - I guess 2Dto3D
could basically use Extrude
and 3Dto2D
would basically be Slice
? It does seem like a lot of overhead, but if it's quick to code it seems well worthwhile. We should be able to swap it out later without breaking the API in any case. Do you want to give it a try?
from manifold.
@geoffder is there a WASM build of clipper2 maybe ?
from manifold.
@hrgdavor I'm not really sure, but this issue is the only one that turns up in a search for WASM, and it sounds like building with emcc wasn't cause for much grief at the time after all.
from manifold.
I've thrown together a minimal example of using Clipper2 in the 2d-via-clipper branch of my fork. I left Polygons
as it is in this prototype, since I wasn't sure of the best way to integrate it. I figured a class that could be automatically constructed from the clipper wrapper class would save the need for the overloads on the extrusion functions at least, but I left out an experiment with that for now.
There are more methods from clipper2 (offset, path simplification, minkowski) that I haven't done yet, and transformations/shapes other than translate and square that need filling out, but this skeleton gets from end-to-end in the clippoly_test.cpp
example.
from manifold.
@geoffder Awesome! Would you mind opening a draft PR to make it a bit easier to peruse and comment on? I'd like to think through API shape for this, but it'll help to have some code to look at.
from manifold.
Related Issues (20)
- wasm build problem 'Failed to resolve import "./built/manifold"' HOT 7
- mesh size approximation HOT 21
- Wrong pkg-config package name for Clipper2 dependency HOT 2
- Python created object reports as non-manifold. HOT 3
- Watertightness of Mesh with an Edge Shared by 4 Faces
- vertex halfedge iterator
- Manifold 2.4.5 release tar.gz is incomplete HOT 3
- Vec out of Range HOT 8
- Python binding needs two import call HOT 4
- Manifold Decompose doesn't preserve vertex properties HOT 4
- memory leak when TBB and PSTL is enabled HOT 27
- Triangulate bug: Two separate polygons HOT 5
- [Question] robust geometric predicates, polygon triangulation
- Warning comparison of integer expressions of different signedness
- Modularize Manifold HOT 17
- Build without exceptions HOT 1
- Remove Thrust HOT 19
- How to figure out required size of mem in the C-API? HOT 1
- Crash in Project() HOT 4
- gcc14 build failure HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manifold.