ArcShape: ArcAngle = 2 * Pi

I placed a SlideBar set to 0 … 100 to control the ArcAngle value. If I set the value to 100, I get no graphic. So I tried ArcAngle = 2 * Pi as displayed below:

// This is a property of an ArcAngle Object2D:
a.ArcAngle = 2 * Pi

Nothing will be displayed. But if I lower down (2 * Pi) a bit, I get the whole circle on screen. What Am I doing wrong ?

Example from ArcShape doc:

Dim a As New ArcShape
Dim Pi As Double

// Fill Pi with (?) Xojo value given in an example…
Pi = 3.1415926535897932384626433832795

a.StartAngle = 0 // Start drawing at the natural 0 // Was: -1.57
a.ArcAngle = 2 * Pi // Was: 1.57
a.FillColor = RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

The code is placed in Window1.Paint

What happens / Is this a bug ? Must I use an If block to test that value (100) and set the rad just below 2? ?

Hi Emile,

Just trying to guess here. Could it be that the double resulting from 2Pi is stored as a number actually larger than two times Pi (the real number) and that arcshape automatically substracts 2Pi from it, so you are drawing your arcshape from 0 to almost 0 (wrong 2pi minus correct 2*pi)?

If you reduce the number of decimals of the Pi constant you get what you are after, and the precision of the angle is still very high. Pi = 3.1415926535897 was ok in my test.

Julen

Julen: thank you for your answer.

First part of the answer: the value is set in a slider (value range are from 0 to 100)

Second part: 3.14159 works fine too.

Yes, I comes from a large precision and fall into a far smaller precision ;:slight_smile: