#### Archived

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

# 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.

## 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 on other sites
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 on other sites
Be warned about floating-point rounding errors, they might mess everything up if you''re not careful.

- JQ
Full Speed Games. Period.

##### 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 on other sites
JoshKlint:

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

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633665
• Total Posts
3013241
×