Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failed/sidemapIsEmpty on fixTJunctions #60

Open
bebbi opened this issue Apr 1, 2015 · 1 comment
Open

Assertion failed/sidemapIsEmpty on fixTJunctions #60

bebbi opened this issue Apr 1, 2015 · 1 comment

Comments

@bebbi
Copy link
Collaborator

bebbi commented Apr 1, 2015

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;
    }
@joostn
Copy link
Owner

joostn commented Apr 1, 2015

I'm looking into this now..

joostn added a commit that referenced this issue Apr 1, 2015
see #60

If a polygon had two verices very close together, these may become truly
identical vertices after canonicalization. fiTJunctions choked on this.

Fix: canonicalization removes identical vertices from polygons.
fixTJunctionsdoes implicit canonicalization so the problem cannot occur
anymore.
kaosat-dev pushed a commit to jscad/csg.js that referenced this issue Jan 7, 2017
see joostn/OpenJsCad#60

If a polygon had two verices very close together, these may become truly
identical vertices after canonicalization. fiTJunctions choked on this.

Fix: canonicalization removes identical vertices from polygons.
fixTJunctionsdoes implicit canonicalization so the problem cannot occur
anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants