You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- The normal of the plane fromed by vec12 and vec1s.
264
264
norm121s = vec1s `cross` vec12
265
-
-- The distance along vec13 to find the intersertion of a ray from source in direction direction, and the plane our triangle is on.
265
+
-- The distance along vec13 to find the intersection of a ray from source in direction direction, and the plane our triangle is on.
266
266
v = (direction `dot` norm121s) / determinate
267
-
-- The distance along the ray to find the intersertion of a ray from source in direction direction, and the plane our triangle is on.
267
+
-- The distance along the ray to find the intersection of a ray from source in direction direction, and the plane our triangle is on.
268
268
t = (vec13 `dot` norm121s) / determinate
269
269
270
270
-- With inspiration from: https://github.com/RenderKit/embree/blob/master/tutorials/common/math/closest_point.h
271
-
-- FIXME: Sensitive to really skinny triangles; detect these, and select a different 'v1'?.
272
271
distancePointToTriangle::V3ℝ-> (V3ℝ,V3ℝ,V3ℝ) ->ℝ
273
272
distancePointToTriangle point (virtex1, virtex2, virtex3) = distance point closestPointToTriangleCenteredSorted
274
273
where
275
-
-- FIXME: Here are two precision error mitigation wrappers. Find out if they're needed.
276
-
-- Reorder triangles such that we use one of the corners of the longest side to address the space in barycentric coordinates. Yes, this is wrong, but it's much more numerically stable?
274
+
-- Reorder triangles such that we use the corner away from the longest side to address the space in barycentric coordinates.
0 commit comments