Making it wasn't too hard. I didn't start it from complete scratch. If you look at my first posts you can see that I at first had trouble doing the simplest geometrical calculations, but slowly gathered more information and quickly became better.
My best tip on making a function like this is:
1. Start by planing what you want to do.
2. Leave the maths out, and just think how you could do it. (kinda like vectors: to get to point B, I need to go from point A to point D, from there to C and then I can reach B)
3. Try to figure the math as best as you can.
4. The rest can "easily" be found online. Describe on google what you want to calculate, and chances are someone else has already asked it, and got an answer.
Patience, you'll have to wait for it for a while ...Or still try to figure it out yourself. But yeah, I admit this might be an unfairly tricky challenge. Just don't lose your hopes, there's a Finnish saying "No one is a blacksmith at birth".codinitup wrote:I would like to see the answer
Thanks. It's not really a "polygon" or maybe I'm just not exactly sure what a polygon really is : -Pchili wrote:Pretty sweet lux.
Filling a convex polygon --
I used for the filling a similar method as in my new sight check stuff in the shooter game, but just inverted. Similar to your draw disc function, except that I just check using vector calculations if the point is on the right side of all lines, and then it obviously is inside the object. Also to speed it up, I use 3x3 pixels for it... It's fairly fast method, but nothing I would use in a huge ass 3d game. Maybe after some optimisation.