Discuss Scratch

cant_scratch_me
Scratcher
2 posts

How do I draw a circle using pen?

I need to draw a circle when I know the x and y coordinates of the centre and the radius of the circle using pen, how do i do it
Yusei-Fudo
Scratcher
1000+ posts

How do I draw a circle using pen?



I have a way.


You could try this:

j_a_n_t_i
Scratcher
500+ posts

How do I draw a circle using pen?

repeat ((360) / (c))
move (5) steps
turn cw (c) degrees
end
ImRohan10187
Scratcher
36 posts

How do I draw a circle using pen?

If you want a filled circle it will be like this:

when green flag clicked
Erase All
Pen Up
go to x: (Wherever you want) y: (Wherever you want)
Set Pen Size to ((Radius) / (2))
Pen Down
Pen Up

If you want a outlined circle, it will be a little more complicated:

Make a Custom Block called “Draw Outlined Circle” and make sure to RUN WITHOUT SCREEN REFRESH

And use the following code:

define Draw Outlined Circle
set [Pi v] to [3.141592]
Pen Up
go to x: (Wherever you want) y: (Wherever you want)
change y by (Radius)
point in direction (90 v)
Pen Down
repeat (360)
move ((((Radius) * (2)) * (Pi)) / (360)) steps
turn cw (1) degrees
end

I really hope this script will help you
If it does, I will surely appreciate a follow, but it's your choice

Last edited by ImRohan10187 (May 25, 2021 05:14:01)

awesome-llama
Scratcher
1000+ posts

How do I draw a circle using pen?

Here's an alternative solution which involves a mathematical representation of a circle.
https://scratch.mit.edu/projects/535519477/


It's hard to explain so here is a visualisation of what I did, although in my script the direction starts from the top (0 degrees in Scratch) and rotates clockwise.

Last edited by awesome-llama (May 25, 2021 06:32:28)

SansStudios
Scratcher
1000+ posts

How do I draw a circle using pen?

awesome-llama wrote:

Here's an alternative solution which involves a mathematical representation of a circle.

+1 for this solution. OP specifically asked how to draw a circle with a radius and vertex.
The_Imaginarium
Scratcher
1000+ posts

How do I draw a circle using pen?

awesome-llama wrote:

Here's an alternative solution which involves a mathematical representation of a circle.
https://scratch.mit.edu/projects/535519477/

I don't understsnd why you need to “start” any where. If you place the pen down and pen up blocks inside the loop, it shouldn't matter where you begin.
repeat (360)
go to x: ((([sin v] of (i)) * (rad)) + (offsetx)) y: ((([cos v] of (i)) * (rad)) + (offsety))
pen down
pen up
change [i v] by (1)
end
And you don't need to set the angle to 0 when beginning your circle, because sine and cosine don't care about that.

Last edited by The_Imaginarium (May 25, 2021 10:41:28)

cant_scratch_me
Scratcher
2 posts

How do I draw a circle using pen?

say [Thank you all for your help!]
Binary-Alt
Scratcher
13 posts

How do I draw a circle using pen?

This is my outlined circle code
.

Powered by DjangoBB