Jax.Geometry.Triangle#intersectTriangle receives an optional vec3 to store the point of intersection, but internally the vec3 is eventually passed into Jax.Geometry.Line#intersectLineSegment, which expects a Jax.Geometry.Line and not a vec3. This causes the following rather spectacular barf:
TypeError: Cannot set property '0' of undefined
at Object.set (http://localhost:3000/assets/glMatrix.js?body=1:77:10)
at klass.intersectLineSegment (http://localhost:3000/assets/jax/geometry/line.js?body=1:100:26)
at slow_tri_tri_intersect (http://localhost:3000/assets/jax/geometry/triangle.js?body=1:25:13)
at klass.intersectTriangle (http://localhost:3000/assets/jax/geometry/triangle.js?body=1:225:24)
Not only must this be resolved, a smarter implementation would check whether dest is a vec3 or Line. If it is a vec3, then it should be populated with the center point of the intersecting line, to avoid biasing the collision point towards A or B along the line.
The offending code is in the slow_tri_tri_intersect function, but the resolution could conceivably be added to intersectLineSegment for better results with vec3.
Jax.Geometry.Triangle#intersectTriangle
receives an optionalvec3
to store the point of intersection, but internally thevec3
is eventually passed intoJax.Geometry.Line#intersectLineSegment
, which expects aJax.Geometry.Line
and not avec3
. This causes the following rather spectacular barf:Not only must this be resolved, a smarter implementation would check whether
dest
is avec3
orLine
. If it is avec3
, then it should be populated with the center point of the intersecting line, to avoid biasing the collision point towards A or B along the line.The offending code is in the
slow_tri_tri_intersect
function, but the resolution could conceivably be added tointersectLineSegment
for better results withvec3
.