Discuss Scratch

secretagent123
Scratcher
1000+ posts

Drawing a circle using a radius.

Hello.
How do I draw a circle with the pen using only the radius as an input.
deesawhney
Scratcher
97 posts

Drawing a circle using a radius.

clearsetradiusto5setturnto0repeat360penupgotox:0y:0pointindirectionturnmoveradiusstepspendownpenupchangeturnby1

This works well enough for me. If you want to fill in the circle, take out the pen up blocks.
secretagent123
Scratcher
1000+ posts

Drawing a circle using a radius.

deesawhney wrote:

clearsetradiusto5setturnto0repeat360penupgotox:0y:0pointindirectionturnmoveradiusstepspendownpenupchangeturnby1

This works well enough for me. If you want to fill in the circle, take out the pen up blocks.
Thank you for answering quickly.
SparshG
Scratcher
500+ posts

Drawing a circle using a radius.

pendownrepeat360gotox:centerOfCircleX+rad*cosofangley:centerOfCircleY+rad*sinofanglechangeangleby1

To improve the quality more, you can increase repeat to say 720, and change angle by 0.5 such that 0.5 * 720 = 360

If you notice, decreasing the repeats will make polygons. If you make repeat to 4, change angle by 90, (again 4*90=360) you should get a square. In fact circle is just we are making polygons but with so many vertices that it looks like circle ;D

Last edited by SparshG (Dec. 24, 2020 18:21:08)

deesawhney
Scratcher
97 posts

Drawing a circle using a radius.

SparshG wrote:

pendownrepeat360gotox:centerOfCircleX+rad*cosofangley:centerOfCircleY+rad*sinofanglechangeangleby1

This works better than mine; it draws lines between the points instead of dots

Powered by DjangoBB