Jump to content
  • Advertisement

Archived

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

PoisKaille

does a point belong to this face ?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I want to know if a given point is part of a face (triangle) in a 3d world. I know the coordinates of the 3 points of the face (P1,P2,P3) and the coordinate of the point i want to test (M).

Share this post


Link to post
Share on other sites
Advertisement
http://www.faqs.org/faqs/graphics/algorithms-faq/

Assuming the point is in the same plane as the polygon:

2.03: How do I find if a point lies within a polygon?


Otherwise your best bet is to test whether a ray which passes through the point also hits the polygon:

5.06: How do I determine the intersection between a ray and a triangle?


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
That answer you got was completely off. Here's how to do it. This returns 0 if the point is on the plane, <>0 for in front or behind:

function pointonplane(x.f,y.f,z.f,nx.f,ny.f,nz.f,d.f)
Return (nx*x+ny*y+nz*z+d)
end function

[edited by - JoshKlint on September 13, 2002 7:02:16 PM]

Share this post


Link to post
Share on other sites
JoshKlint:

Umm - read the posters message, and re-read my reply. So what part of my reply is "completely off" ?.

In fact your reply is "completely off" with regard to the question since it only confirms whether a point is in the **infinite** plane. PoisKaille asked how to determine whether the point was in the the **triangle** (i.e. bounded plane).



--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!