Advertisement

Point in Triangle / Collision Detection

Started by January 07, 2003 02:17 PM
2 comments, last by Krumble 22 years, 1 month ago
I was reading a tutorial online about Collison Detection between a point and a triangle, and it made sense to me. I understand how to find the intersection point between a ray and a plane, but my question comes with finding if the point is within the triangle I''m checking against. The tutorial stated that you take the intersection point on the plane, and you calculate three more vectors to each corner in the triangle, and normalize them. Use the dot product to calculate the angle between corners 1 and 2, 2 and 3 and 1 and 3, then add the angle and it should be 360 degrees, which also makes sense, but the code he showed to do this check used arccos on the dot product to calculate the angles, before adding them, then using an eplison test to check that it''s close to 2*Pi. I was wondering if this can be done without using arccos, and just using the dot products themselves to speed up the code a little bit? Here''s a link to the tutorial: http://www.cfxweb.net/~cfxamir/cd3.html Thanks Kevin
Kevin.
another way is to do the point edge check test


take a vertex of the triangle get the vector vertex->point
then check whether point +a*vertex->point intersects an edge which "a" is positiv if so it lies inside the triangle
http://www.8ung.at/basiror/theironcross.html
Advertisement
View the forum FAQ, questions 9 and 10 at the bottom:

Forum FAQ

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
i knew your answere i have asked the same thing a few months ago
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement