One reason to trigger a "assertion failed" error in fixTJunctions appears to be related to empty polygons.
Those are created by functions such as rotateExtrude, followWith and polyhedron (depending on user input).
Below is an example. I think we should allow empty polygons but reTesselated() should remove them. What do you think? Also, polygon.getArea() is suitable to judge bad polys, but checking every poly might impact performance. Most of these bad polys might contain >1 identical vertices (rather than e.g. all vertices on a line), so that is possibly sufficient to check and may hit performance less. Any ideas there?
(Note, reTesselateCoplanarPolygons contains a check for degenerate polygons which I superficially fixed in last commit, but obviously doesn't capture most cases - this check might be improved as well)
function main() {
var cag = CAG.fromPoints([[1, 0], [0, 1], [0, 0]]);
var csg_fail = cag.rotateExtrude({
angle: 360,
resolution: 18
});
var csg_pass = CSG.fromPolygons(
csg_fail.polygons.filter(function(p){return p.getArea() > 1e-10}));
return csg_fail;
}
One reason to trigger a "assertion failed" error in fixTJunctions appears to be related to empty polygons. Those are created by functions such as
rotateExtrude
,followWith
andpolyhedron
(depending on user input).Below is an example. I think we should allow empty polygons but
reTesselated()
should remove them. What do you think? Also,polygon.getArea()
is suitable to judge bad polys, but checking every poly might impact performance. Most of these bad polys might contain >1 identical vertices (rather than e.g. all vertices on a line), so that is possibly sufficient to check and may hit performance less. Any ideas there? (Note,reTesselateCoplanarPolygons
contains a check for degenerate polygons which I superficially fixed in last commit, but obviously doesn't capture most cases - this check might be improved as well)