Bug in splitting algorithm
NMO13 opened this issue · 0 comments
NMO13 commented
The following code will result in an endless recursion. I think this is a problem due to rounding errors. The first poly is a triangle, the second poly is a quad.
var l = [], polys = [];
l.push(new CSG.Vertex(new CSG.Vector(1.23079, 0.35525, -0.39928), new CSG.Vector(0, 0, 0)));
l.push(new CSG.Vertex(new CSG.Vector(1.26563, 0.28906, -0.40625), new CSG.Vector(0, 0, 0)));
l.push(new CSG.Vertex(new CSG.Vector(1.24346, 0.44424, -0.41733), new CSG.Vector(0, 0, 0)));
polys.push(new CSG.Polygon(l));
var l2 = [];
l2.push(new CSG.Vertex(new CSG.Vector(1.26216, 0.46369, -0.43822), new CSG.Vector(0, 0, 0)));
l2.push(new CSG.Vertex(new CSG.Vector(1.36719, 0.29688, -0.50000), new CSG.Vector(0, 0, 0)));
l2.push(new CSG.Vertex(new CSG.Vector(1.35204, 0.32133, -0.34461), new CSG.Vector(0, 0, 0)));
l2.push(new CSG.Vertex(new CSG.Vector(1.25679, 0.47373, -0.34461), new CSG.Vector(0, 0, 0)));
polys.push(new CSG.Polygon(l2));
var res = CSG.fromPolygons(polys);
var a = new CSG.Node(res.toPolygons());
var result = a.AllPolygons();