Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filled polygons

Status
Not open for further replies.

peekay

Programmer
Oct 11, 1999
324
ZA
I am sorry for this hairy one on a Saturday evening but I need the solution - albeit not instantly.
In my application (a graphics one) I need to draw two filled 2D polygons of any size and shape in 3D space. That I do with the relevant API function and the necesaary matrix rotations. The problem however is that the elevational view of the two polygons may sometimes overlap (interfere) and it is important which polygon is nearer the viewer.
I need to establish which polygon is nearer the viewer so that I can block the obstructued view of the back one out. I also need to know how to "undraw" the blocked out portion of the back one.
I will appreciate help from someone working in this field.


PK Odendaal
pko@mweb.co.za

 
I don't work in graphics, but I used to play around with it a little.

Unless you have additional constraints besides those you mention, "which polygon is nearer the viewer" is ambiguous. A single polygon could potentially have both the closest and the most distant points from the viewer.

Assuming you mean "which polygon is nearer the viewer in the projected overlap area", is it guaranteed that the polygons will not intersect? If so, the problem reduces to calculating the projected overlap region of each polygon, then picking any point in each region to determine which is closer. If they can overlap, you have to divide each polygon along the intersection line and treat them as separate pairs.

I don't have an easy answer to calculating the projected overlap, which is very possibly what you're mostly asking for. Sorry. But as for "undrawing" the hidden surface, do you really need to do that? Usually you just draw from the back to the front, and let the front one overlay the back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top