CSG.Polygon assumes no collinear edges
ericu opened this issue · 4 comments
If you try to create a CSG.Polygon, passing in a series of vertices where the first 3 are collinear, the calculation of the plane normal will be wrong. The documentation for the function only requires that the polygon be planar and convex, not that it contain no degeneracies; either the code or the docs should change.
The problem is at the polygon constructor. There it constructs a plane from the first three points. If these are colinear they should not be used untill none colinear are found.
That looks like a relatively easy fix, but I'm not sure that this repository is still being maintained.
@NateTG I think I've seen issues in my app related to this. Would really appreciate a fix if you have the time and energy.
I'm still a js neophyte, but the changes at:
https://github.com/NateTG/csg.js
Should support polygons with some non-colinear edges.