Have I made a boo boo?
Sometimes my triangles are coming out left handed rather than right handed and i’m not sure why… I think it might be this surface normal… but not sure.
Does this look correct?
[code]Public Function ComputeFaceNormal(t as WalkingTetraHedrons.Triangle) as WalkingTetraHedrons.XYZ
//Set Vector U to (Triangle.p2 minus Triangle.p1)
//Set Vector V to (Triangle.p3 minus Triangle.p1)
//Set Normal.x to (multiply U.y by V.z) minus (multiply U.z by V.y)
//Set Normal.y to (multiply U.z by V.x) minus (multiply U.x by V.z)
//Set Normal.z to (multiply U.x by V.y) minus (multiply U.y by V.x)
dim U, V, norm as WalkingTetraHedrons.XYZ
dim len as single
U.x = t.p(1).x - t.p(0).x
U.y = t.p(1).y - t.p(0).y
U.z = t.p(1).z - t.p(0).z
V.x = t.p(2).x - t.p(0).x
V.y = t.p(2).y - t.p(0).y
V.z = t.p(2).z - t.p(0).z
norm.x = U.y * V.z - U.z * V.y
norm.y = U.z * V.x - U.x * V.z
norm.z = U.x * V.y - U.y * V.x
len= sqrt((norm.xnorm.x) + (norm.ynorm.y) + (norm.z*norm.Z))
norm.x = norm.x / len
norm.y = norm.y / len
norm.z = norm.z / len
return norm
End Function
[/code]