OpenJsCad icon indicating copy to clipboard operation
OpenJsCad copied to clipboard

Assertion failed/sidemapIsEmpty on fixTJunctions

Open bebbi opened this issue 10 years ago • 1 comments

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;
    }

bebbi avatar Apr 01 '15 13:04 bebbi

I'm looking into this now..

joostn avatar Apr 01 '15 14:04 joostn