Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Rendering a 2D Circle
- rifj190
- Scratcher
25 posts
Rendering a 2D Circle
Hello fellow scratchers,
Recently, I have been exploring 2D and 3D rendering. I was looking at a few interesting programs when the thought of rendering a circle crossed my mind. I have tried mad algorithms and equations but they all work rather slowly. Scratch is not the fastest thinking language so when rendering anything, you must use as few blocks as possible.
Does anyone know of a quick method of rendering a circle?
Thank you all so much.
Recently, I have been exploring 2D and 3D rendering. I was looking at a few interesting programs when the thought of rendering a circle crossed my mind. I have tried mad algorithms and equations but they all work rather slowly. Scratch is not the fastest thinking language so when rendering anything, you must use as few blocks as possible.
Does anyone know of a quick method of rendering a circle?
Thank you all so much.
Last edited by rifj190 (Dec. 8, 2013 03:48:52)
- ProdigyZeta7
- Scratcher
1000+ posts
Rendering a 2D Circle
To render a circle takes lots of computational power, regardless of the method used.
define Circle at x: (x) y: (y) radius (r) steps (s)
set [theta v] to [0]
repeat ((s) + (1))
go to x: ((x) + ((r) * ([sin v] of (theta)))) y: ((y) + ((r) * ([cos v] of (theta))))
pen down
change [theta v] by ((360) / (s))
end
pen up
- rifj190
- Scratcher
25 posts
Rendering a 2D Circle
To render a circle takes lots of computational power, regardless of the method used.define Circle at x: (x) y: (y) radius (r) steps (s)
set [theta v] to [0]
repeat ((s) + (1))
go to x: ((x) + ((r) * ([sin v] of (theta)))) y: ((y) + ((r) * ([cos v] of (theta))))
pen down
change [theta v] by ((360) / (s))
end
pen up
Thanks so much! Check out the project that I am about to post that demonstrates rendering a circle. After that, I will make a 3D one :=!
- Discussion Forums
- » Help with Scripts
- » Rendering a 2D Circle