The radius of your "circle" should be 57.28996163075943
pixels and can be calculated like so:
import math
radius = math.sin(math.radians(89)) / math.sin(math.radians(1))
print('Radius of circle =', radius)
The reason this is true stems from the fact that your circle is not really a circle. It is composed of 360 different triangles. In particular, they are all ASA (angle, side, angle) triangles. Let us assume that when beginning to draw your circle, your turtle starts on a tangent of the circle. That means that if you were to draw a line that passed through the center of the circle you are drawing and the turtle that is making the drawing, your turtle's direction would be perpendicular to that line. Therefore, we can say the following:
angle_a = 90
We are saying that the first angle we know anything about in our triangle is 90 degrees. The next piece of information we need is the length of a side. Since the turtle draws a line of 1 pixel, we know that is the length and can add that to our notes:
angle_a = 90
side_c = 1
The final thing we need to know is one more angle. Now this has to be derived from previous knowledge since it may not be obvious at first. At the beginning of each drawing step, our turtle is parallel to a tangent on the circle; and that means that after turning the turtle by 1 degree, it is ready to begin the next drawing step and must be on a tangent. Therefore, at the end of a drawing step, it should be possible to trace a line back to the middle of the circle by following a path perpendicular to the direction the turtle is facing. Since a turn of 1 degree was made, we know that the other angle of the triangle we are making must be 89 degrees.
angle_a = 90
side_c = 1
angle_b = 89
From this we can conclude that the other angle in the triangle at the center of the circle must be 1 degree.
angle_a = 90
side_c = 1
angle_b = 89
angle_c = 1
Now that we have all this information, we can use the law of sines to find out the lengths of the other two sides of the triangle. We will get two different values. The first is the length of side a, the hypotenuse; and the second is the length of side b, the radius. You will notice that the longer length is how far away from the center of the circle the turtle is after its first drawing step. For purposes of calculating the radius, I chose to go with the second measurement which is barely any different.
It is time to solve some formulas:
side_a / sin(angle_a) = side_c / sin(angle_c)
side_a / sin(90) = 1 / sin(1)
side_a = sin(90) / sin(1)
side_a = math.sin(math.radians(90)) / math.sin(math.radians(1)) # hypotenuse
side_b / sin(angle_b) = side_c / sin(angle_c)
side_b / sin(89) = 1 / sin(1)
side_b = sin(89) / sin(1)
side_b = math.sin(math.radians(89)) / math.sin(math.radians(1)) # radius
You may also choose to average the lengths of sides a and b to get a better approximation of your circle's radius:
print('Radius of circle =', (side_a + side_b) / 2)
From this, you will get 57.29432506465481
as your approximate radius in pixels.
Addendum
After doing a little more research into the matter, it was easy to develop a function to help solve problems like this more easily in the future. Please realize that polygons do not necessarily have a diameter, but even-sided ones have at least two radiuses that are parallel with each other. Getting the radius with the following function is as easy as dividing its result by two. Example usage is included:
import math
def get_polygon_diameter(side_length, side_rotation):
return side_length / math.sin(math.pi * side_rotation / 360)
length_of_each_side = 1 # in pixels
rotation_per_side = 1 # in degrees
diameter = get_polygon_diameter(length_of_each_side, rotation_per_side)
radius = diameter / 2
print(f'Radius of "circle" that is actually a polygon = {radius:.3f} pixels')
360 = 2 * π * r
sor = 180 / π