Trouble with DzBox3.getIntersection
kabexef
Posts: 77
I have created a box and determined the intersection points with a ray. Instead of the expected values, I get [0,0,0] and [1,1,-1]. If I swap the ends of the ray, I get [0,0,0] and [1,1,5].
I would have expected to need only one call and get the values [1,1,-1] and [1,1,5]. Did I misunderstand something or is something not working as it should?
var box = new DzBox3("[[ -3, -2, -1 ],[ 5, 5, 5 ]]"); //[[ minX, minY, minZ ],[ maxX, maxY, maxZ ]]print("box:", box);var ray = new DzLine3(new DzVec3(1, 1, 10), new DzVec3(1, 1, -20));var intersection = box.getIntersection(ray);print("Intersect:", intersection.intersects, "- first:", intersection.firstIntersection, "- last:", intersection.lastIntersection);ray.swapEnds();intersection = box.getIntersection(ray);print("Intersect:", intersection.intersects, "- first:", intersection.firstIntersection, "- last:", intersection.lastIntersection);
The output is
box: [[-3,-2,-1],[5,5,5]]
Intersect: true - first: [0,0,0] - last: [1,1,-1]
Intersect: true - first: [0,0,0] - last: [1,1,5]
Comments
This was brought up before in this thread - DzBox3 getIntersection question. Was supposedly fixed in 4.14.1.36, but appears not to have been. Probably needs a bug report filed - https://helpdaz.zendesk.com
*edit*
To be clear, by this was brough up before, I mean an issue with this method. It did change in 4.14.1.36, but still does not match the documented result.
Thanks for reply. I filed the bug report.