Sign in to follow this  

Filling empty shape algoritm

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

Hi all,

I faced with the problem when I need to fill created shape with some color, but the problem is that my geometry is empty inside. Its just a border consisting of 4 rectangles. I know that WPF and also D2D have algorithms for filling any geometry with color, but how to do it in DirectX?

 

I am wondering does someone already did something similar?

Share this post


Link to post
Share on other sites
Render something (triangles, perhaps) that fills the space?

This feels like a question where you've left out 99% of the problem, because what you've described is extremely simple to solve. Edited by Nypyren

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Its not so simple, because geometry could be very complex genereate triangles for it would be not so easy.


You should not have ever said this, then:
 

Its just a border consisting of 4 rectangles.


Depending on how complex your input polygon is, you could... https://en.wikipedia.org/wiki/Polygon_triangulation (the convex intersecting case seen in your second link may require finding and adding intersecting vertices before triangulation)

Or you can just do it raster style pixel-by-pixel. I'm not sure which way WPF does it.

Of course since I'm not a graphics guy there is probably some more clever way to do it that I've never heard of. Edited by Nypyren

Share this post


Link to post
Share on other sites

This topic is 665 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.

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