Problems with DzLine3.segmentsIntersect
kabexef
Posts: 71
If I create a DzLine3 with an origin.x as a numeber with decimal places segmentsIntersect and linesIntersect will return false. If I use an integer true will be returned.
var l1 = new DzLine3(new DzVec3(52.9289,12.9289,0), new DzVec3(240,12.9289,0)); var l2 = new DzLine3(new DzVec3(80,0,0), new DzVec3(60,20,0)); print(JSON.stringify(l1.segmentsIntersect(l2))); // returns false print(JSON.stringify(l1.linesIntersect(l2))); // returns false var l1 = new DzLine3(new DzVec3(53,12.9289,0), new DzVec3(240,12.9289,0)); var l2 = new DzLine3(new DzVec3(80,0,0), new DzVec3(60,20,0)); print(JSON.stringify(l1.segmentsIntersect(l2))); // returns true print(JSON.stringify(l1.linesIntersect(l2))); // returns true
Is there any idea what happens?
Post edited by kabexef on
Comments
Try setting a non-zero tolerance, it may simply be a precision issue.
print(JSON.stringify(l1.linesIntersect(l2, 0.1))); // returns false returns true