Change sideplane method for detection of ray inside triangle
Closed this issue · 0 comments
kharon4 commented
Change side plane to Local cord based detection
- Better performance
- Takes less space
Instead of {vec3f normal , vec3f sideNormals[3] }
Use {vec3f normal , vec3f data(1/b.n, b.a, 1/a^2), vec3f n }
a = v[1]-v[0] , b = v[2] - v[0]
Here n is perpendicular to a and |n| = 1; - Free local coord vals
v = l1 * a + l2 * b
v.n = l2 * b.n l2 = v.n/b.n
v.a = l1 * a.a + l2 * b.a l1 = (v.a- l2 * b.a)/a*a '