PDA

View Full Version : How to identify the conjoint edge of two faces?



ljz
01-07-2003, 05:48 PM
Hi,
I want to identify the conjoint edge of two faces or polygons by pixel information, ie, given a pixel, I want to know if it is a pixel on an conjoint edge of two faces or polygons. Anyone can help me?
Thanks.

Coriolis
01-07-2003, 06:28 PM
Treat the edge as a line segment and consider the ray from the camera through the pixel, both in 3D space. See if the closest point of the line segment to the ray is within some small epsilon, where the epsilon is a linear function of distance to compensate for perspective (ie, epsilon * distance). www.magic-software.com (http://www.magic-software.com) has a lot of testing algorithms if you don't know how to do ray to line segment distance checks.

V-man
01-07-2003, 08:36 PM
Render each polygon in a unique color, use glReadPixels to get the "local region of the pixel of interest, then check neighbor pixels for color difference.

Badda bing, badda boum

Coriolis
01-07-2003, 10:19 PM
My way is faster http://www.opengl.org/discussion_boards/ubb/biggrin.gif

ljz
01-12-2003, 06:12 PM
Thanks you all. Let me have a try.