I have been doing a lot of work
trying to get the next shape
in the graphics sequence,
and discovered an aberration
in my version of Python 3.8 32-bit.
I don't know if this is the case
for everyone downloading this version.
But I discovered,
that when drawing the circle,
this program doesn't produce
a balanced shape.
For a circle of -
Pt.forward(1)
Pt.right(1)
the four equidistant points on the circle are -
(0.00, 0.00)
(57.79, -56.79)
(1.00, -114.59)
(-56.79, -57.79)
(-0.00, 0.00)
They should be balanced, something like -
(0.00, 0.00)
(57.29, -57.29)
(0.00, -114.58)
(-57.29, -57.29)
(0.00, 0.00)
On closer inspection of the 4 points,
I found them to all be
one pixel to the left of where they should be.
With some trial and error, I discovered,
that if I correct the initial orientation of the arrow, by
Pt.right(0.5) degrees
Then, the 4 equidistant points on the new circle are -
(0.00, 0.00)
(57.30, -57.30)
(-0.00, -114.59)
(-57.30, -57.30)
(-0.00, 0.00)
Which can be seen to be balanced.
So I advise, if you have this problem
when drawing a circle on this program,
then make the adjustment of -
Pt.right(0.5)
at the beginning of the sequence.
N
Also, I had been using -
n = radius / 57.35
This seems to be a little inaccurate, from observing above, that -
2 x radius = 114.59
Thus,
radius = 114.59 / 2
= 57.295
when the program is moving at the base level of -
Pt.forward(1)
Pt.right(1)
and,
n = the chord subtended by a 1 degree turn of the circle
Hence, to get a circle of the desired radius here, using -
Pt.forward(1)
Pt.right(1)
n needs to be adjusted to -
n = radius / 57.295
For example, if a circle is required, of -
radius = 50
in this program, the adjustment needed is -
n = 50 / 57.295
which gives you a chord that is slightly shorter,
and the circle drawn will end up with -
radius = 50
not,
radius = 57.295
I have tested this,
and it is accurate enough up to -
radius = 400
which is a circle that is a bit larger
than an approx. 39cm (diagonal) computer screen.
:)
text (c) Katherine Stuart 2021
Dochas Books Film
No comments:
Post a Comment