Filling a polygon. SOLVED.
Filling a polygon. SOLVED.
Hello everyone!
So i saw this post and decided to take the chalange and replicate Luxs polygon drawing function.
http://www.planetchili.net/forum/viewto ... =triangles
It wasn't hard to draw the polygon it self, but the filling part was just imposible for me
I tried looking it up on the net, but I couldn't find much help...
Tips or any help on how to fill polygons would be nice
Thank you!
So i saw this post and decided to take the chalange and replicate Luxs polygon drawing function.
http://www.planetchili.net/forum/viewto ... =triangles
It wasn't hard to draw the polygon it self, but the filling part was just imposible for me
I tried looking it up on the net, but I couldn't find much help...
Tips or any help on how to fill polygons would be nice
Thank you!
Last edited by SunShine on February 23rd, 2013, 11:47 am, edited 1 time in total.
Re: Filling a polygon. HELP!
Would you have to do something like shading the inequality? It sounds like you could somehow apply that here.
Re: Filling a polygon. HELP!
Hi Lux.
In the other topic you said that you were running through a plane of pixels and checking if the pixel is on the right side of every line. But how can you do that when you only have the corner coordinates
Come on Lux remember the magic, that polygon is asking to be filled
In the other topic you said that you were running through a plane of pixels and checking if the pixel is on the right side of every line. But how can you do that when you only have the corner coordinates
Come on Lux remember the magic, that polygon is asking to be filled
Re: Filling a polygon. HELP!
hmm... maybe testing to see if the angle from vertex to pixel is greater than the angle from vertex to vertex? Just a guess, probably not.
Musi
There are 10 types of people that understand binary.
Those that do, and those that don't.
There are 10 types of people that understand binary.
Those that do, and those that don't.
Re: Filling a polygon. HELP!
The way I did it is check if the pixel is on the right side of all lines, like I explained, I think, in the other topic. If you read it you will also see chili mentioning scan line which would make it a lot faster, but it might be a bit hard for now.
ʕ •ᴥ•ʔ
Re: Filling a polygon. HELP!
Damn! I can't fill it...
I tried what Musi suggested and tried to calculate stuff like Lux said, but I couldnt fill the poly entirely. Most of the time I end up with some strange things on the screen
I have seen and read a bit about the scan-line algorithm, but I kinda don't want to go that way. ( it looks complicated on the first look )
To Lux:
Please tell me more how you calcute the lines / vectors.
( what kind of method/algorithm you use )
Thanks!
I tried what Musi suggested and tried to calculate stuff like Lux said, but I couldnt fill the poly entirely. Most of the time I end up with some strange things on the screen
I have seen and read a bit about the scan-line algorithm, but I kinda don't want to go that way. ( it looks complicated on the first look )
To Lux:
Please tell me more how you calcute the lines / vectors.
( what kind of method/algorithm you use )
Thanks!
Re: Filling a polygon. HELP!
Thanks Lux!
I have done it
I have done it