OpenJSCAD.org
OpenJSCAD.org copied to clipboard
Is poly2 always convex?
The API description states that poly2
is always convex:
https://github.com/jscad/OpenJSCAD.org/blob/f5f31084843adebaeb481c064eb09634fb7490a0/packages/modeling/src/geometries/poly2/create.js#L2
But looking in the code, poly2
is created from geom2 outlines, which may not be convex:
https://github.com/jscad/OpenJSCAD.org/blob/f5f31084843adebaeb481c064eb09634fb7490a0/packages/modeling/src/operations/expansions/offsetGeom2.js#L28-L30
Is this a possible bug? Or is the documentation outdated?
Ah… poly2… it was added as part of V2 but is not really 100%. So, I’m not sure where this geometry will be useful. I believe it was added to scope those special functions.
Do you have some use cases?
I was just wondering. I looked into the code for existing parts useful for the implementation of the Minkowski sum. If poly2 isn't guaranteed to be convex, a poly2.isConvex()
function would make sense. Some goes for a decompose function to split a non-convex polygon into convex polygons.
Ah. Now, I understand where this is going. Feel free to contribute functionality to poly2. Please follow name and style similar to poly3, if possible. And of course, some rudimentary tests.
@jue89 theres a set of changes coming for poly2. Can you follow and add comments? Or even better... enhancements.