Sign in to follow this  

Point in Triangular Prism (defined by plane)

Recommended Posts

How do I check if the projection of a point onto a plane is within a triangle on the plane, without actually projecting it?

In other words, how can I test to check if a point is contained in an infinite triangular prism protruding from a plane, given three points of the plane and the point to be tested:

I've tried something already, using the dot products of each vector, but it didn't seem to code is below:


bool pointintrianglevolume(mlVertex P, mlTriangle t){
mlVertex vec1=t.p[0]-P;
mlVertex vec1a=P-t.p[1];
mlVertex vec2=t.p[1]-P;
mlVertex vec2a=P-t.p[2];
mlVertex vec3=t.p[2]-P;
mlVertex vec3a=P-t.p[0];
return (>=0&&>=0&&>=0);

Share this post

Link to post
Share on other sites
Make sure your plane normals for the prism are all facing in the same direction and then use the dot product. If all dots return > 0 or < 0 they are all on one side of all the planes, and hence within the bounds of the prism. If they all return 0 you are in a dimension other than R3. There is another way that uses pluckers but pluckers you use a ray, not a point.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this