2015. február 1., vasárnap

DETERMINE THAT THE MESH POINTS/TRIANGLES/QUADS ARE IS INSIDE "D" DOMAIN

"EARLISH" DETERMINATION THAT THE POINT
IS INSIDE THE DOMAIN OF THE TRIANGLE OR NOT.

To check that T is actually in triangle P1,P2,P3 we need to add
the α,ß,Γ angles together. And if Ω<360.0 then it is outside of the domain of the triangle. To calculate these angles make 3 vectors out of the triangle points and T.

vec1 = normalize( P1-T)
vec2 = normalize( P2-T)
vec2 = normalize( P3-T)

Then the angles:
α = acos(dot vec1 vec2)
ß = acos(dot vec1 vec3)
Γ = acos(dot vec2 vec3)

Ω = α+ß+Γ
finally if Ω<360  then the point is outside of the triangle's domain.

If you have 3d system then flatten it to 2D first, and keep in mind that it is valid only for projection only.

Nincsenek megjegyzések:

Megjegyzés küldése