Portion of a pie and alpha

BlitzPlus Forums/BlitzPlus Programming/Portion of a pie and alpha

Regular K(Posted 2004) [#1]
I need some code that can show me how to draw only a portion of a pie (filled) and being able to alpha that pie too. The pie wont be too big, bigger than 64x128 so im not too worried about speed. Should I?
In 2D!

Ill look in the code archives a bit more to make sure its not there.


Ryan Moody(Posted 2004) [#2]
Let the centre of the pie = (X,Y)
Let 'Target Angle' = How much of the 360 degrees you want to display.
Let 'radius' = The radius of the pie
---------------
Current Angle = -0.1
Repeat
Current Angle=Current Angle+0.1
line X,Y,X+(Sin(Current Angle)*radius),Y+(Cos(Current Angle)*radius)
Until Current Angle = Target Angle

I don't know what 'alpha' means though. Speed may be a problem if this code has to be constantly used in real-time due to the number of lines you'll be drawing.

Ryan


Regular K(Posted 2004) [#3]
I couldnt adapt your code to work, but I used the knowledge I gained from it to make my own :) And it works. Just needs some optimizations.


PantsOn(Posted 2004) [#4]
Ryan code should work OK, not very optimised though and sometimes can lead to gaps appear in the triangle.

The way I did it was draw 5 degrees of a pie at a time and use the code from the code archives to draw a solid triangle betwwen the 3 calculate points.

I might post my code on day.....