Jump to content
  • Advertisement
Sign in to follow this  
gammaomega

planar non-convex polygon from list of points?

This topic is 4267 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

Hello! I'm very new to DirectX programming. Probably the answer to my question isn't all that complicated, by I googled for abount an hour and still did't find a proper solution. So I hope that anybody can help me here. I'm writing a little presentation-tool for displaying maps with DirectX. The given data is a set of polygons. Each polygon is a list of 2D-points. The last points equals the fist one. So all polygons are flat/planar, but they are not necessarily convex. They don't have holes. Currently my apllication uses a linestrip to display these polygons, which works fine. But now I need to fill these polygons with colors. TriangleFans and TriangleStrips can'' render non-convex shapes. Do I'm a little stuck here. :-(

Share this post


Link to post
Share on other sites
Advertisement
Triangle strips and fans don't have any limitation about the convexity of the resulting shape. By supplying a central vertex, a triangle strip should be able to render your polygon.

Share this post


Link to post
Share on other sites
Ok, the last sentence of my first posting is nonsense. :-)
TiangleFan and Strip can indeed render nonconvex shapes.

But your posting doesn't solve my problem.

I have quite complex shapes.
Perhaps something like this:
http://www.sciencebuddies.org/mentoring/project_ideas/Math_img011.jpg

And I only have the vertices in counter-clockwise order.
Simply using a fan or strip certainly doen't produce the expected result.

Share this post


Link to post
Share on other sites
Look up "tessellating non-convex polygons". This well-known technique is used to break up complex shapes into triangle soups or other primitive setups.

Share this post


Link to post
Share on other sites
ok, but where shall I look this up.

I tried google and the search function of this forum and I really didn't find a simple solution for my simple problem :-)

edit:
found this:
http://msdn2.microsoft.com/en-us/library/ms537814.aspx

BUT it's OpenGL. I can't beleave that even on Microsofts website I only find a solution for OpenGL and not Direct3D :-((

[Edited by - gammaomega on April 10, 2007 5:59:45 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!