Sign in to follow this  
gammaomega

planar non-convex polygon from list of points?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this