Sign in to follow this  
vinpowfull

Filling problem with a TriangleFan

Recommended Posts

Hi everyone ! here is a picture of my problem: In red i drew the shape i want to fill (a star). I used a trianglefan primitive (the start point is the one on the left of course) and as you can see, there is an "overlapping" problem. I'm sure some of you are familiar with this problem, I was wondering if there's a simplier solution than subdividing my shape... if not, do you know a good reference about these kind of algorithm ? Thank you ! [Edited by - vinpowfull on July 23, 2009 11:43:18 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by vinpowfull
I'm sure some of you are familiar with this problem, I was wondering if there's a simplier solution than subdividing my shape... if not, do you know a good reference about these kind of algorithm ?
Why not just insert a new point at the centre of the shape and use that as the fan origin?

This is the way triangle fans work, there's no other way around it (in b4 someone with a pixel shader clipping solution [smile]).

Share this post


Link to post
Share on other sites
Adding the first point at center of the fig will work with a star, but not with this one :


Actualy, i just want to fill any given shape, and display it's border. For the border it's ok, i just have to use a LineStrip primitive...
For the filling, maybe there are other way than using TriangleFan... a shader you say ? (oh another cool thing to learn ^^)

Share this post


Link to post
Share on other sites
here are some shapes to fill, each shape having it's own color :


BTW, i think there is a bug with the ScrollViewer, look at the scroll bars. This bug disappear when i use a simple bitmap as ImageSource instead of the D3DImage...
edit: the arrows of the scroll bars are functional, and the content actualy scroll but the matter is their size.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
In order to fill arbitrary concave polygons with standard D3D/OpenGL polygon-drawing facilities, you'll need to do a convex decomposition of each polygon. Here's one way.


Thank you for the link ;) I'll try to implement one of these.
Is somebody know a way to fill with a shader ?

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