Sub GetCircleXY(diameter As Double, angle As Double, ByRef x As Double, ByRef y As Double)
Dim radius As Double
radius = diameter / 2
X = radius * cos(angle)
y = radius * sin(angle)
End Sub
You can then use it like this:
Dim x As Double
Dim Y as Double
GetCircleXY(DiameterInPixels, AngleInRadians, x, y)
msgbox "X:" +Str(x) + ", Y:" + Str(y)
Thats because with angles 0 is at 3 o’ clock and positive values move counter-clockwise. In this picture point A is at 0 angle and B is at some positive angle.
That’s the mathematical standard where coordinates are plotted with positive Y upwards. But the coordinates in Xojos Graphics class are Y downwards (top pixel is Y=0 and Y increases going towards the bottom). So that picture is flipped over the X axis. Basically, with an ArcShape at least, an angle of 0 will put the point at 3 o’ clock on the circle, and increasing values move clockwise.
For the example, a StartAngle of -1.57 means it starts 90 degrees counter-clockwise (because it’s negative) from 3 o’clock. Then an ArcAngle of 1.57 means it’ll trace out an arc of 90 degrees going clockwise. Do the values make sense now?
You could also use a StartAngle of 0 and ArcAngle of -1.57 to draw the same arc shape.
thank you for taking time to explain. I saved this Conversation page for later re-reading (and try to understand).
After talking with someone (here at a local McDonalds), I realized that I will not be able to explain myself to someone the Pie Chart drawing process even if I can use it. I think that is why I ask questions / I feel insecure on the subject.
I understand how I have to code to get the result I want, thanks for many hours of hard work.
I mainly use: Wikipedia / Radian and a Xojo project to check the results.
What I do not understand is why when I give a StartAngle value to 0 and a ArcAngle of 1.57 (half of ?) I get a pie chart that start at 3:00 and ends at 6:00 (in a clock metaphor).
Why using different units (radian, degree) to draw circles and pie chart ? Pie Chart with an image that demonstrates (looking at the USA Part) why I feel sad to not understand why: ArcShape StartAngle = 0, ArcAngle = 1.6 ? (more or less; I mean 1.6 * ?) will not produce the same yellow area.
I have a mental blocking when I do not understand something. When I was young, I scrapped the whole thing. With time, I started to be able to use things even if I do not understand the whole process, but it is hard, very hard, the next time I have to go a similar way.