Archived

This topic is now archived and is closed to further replies.

Damn trig ... or linear algebra ... or whatever ...

This topic is 6188 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Quick question. I''m looking to figure out if a point lies in a poly (3D style collision detection). How do I calculate the angles? Each "polygon" is 4 points, and I need to figure out the angle between two of them and the point I''m testing 4 times, given only their coordinates. The idea being if the angles add up to 360, we have contact. Any help? Chris Barry

Share on other sites
I''m not sure exactly what you''re trying to do, but maybe I can provide another idea...

Assuming you already know your point is on the plane of the poly (ie, distance of point to plane equals zero), you can take directed edge (counter-clockwise is the usual) as a vector, and cross-product it with the normal of the poly''s plane.

The result is the normal of a new plane passing through the edge and perpendicular to the poly. Now perform a distance test of your point with that plane. Repeat for all edges.

Assuming you''re using right-handed coordinate system, if all distances are negative, then your point lies in the poly. If any distance is positve, you''re outside the poly.

I expect this only works for convex polys, though.

---- --- -- -

1. 1
Rutin
26
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 10
• 9
• 9
• 10
• Forum Statistics

• Total Topics
631751
• Total Posts
3002086
×