ScratchData LogoScratchData
Back to grandpasp's profile

No-Trig Ellipse Fill Demo

GRgrandpasp•Created March 19, 2024
No-Trig Ellipse Fill Demo
14
12
111 views
View on Scratch

Instructions

This is a demo of my no-trig ellipse fill algorithm. It first randomly generates the parameters of 100 ellipses (with/without borders, with/without fill). Then it renders all of them in a loop. If you look inside, please do not expect compactness! I've provided a Slow Motion option to let you watch the drawing order.

Description

Thanks to @papipupepappa for the challenge to create an optimized ellipse fill algorithm. The highest priority for this one was "smoothness". Using one of the "trig" methods raises two problems to be solved. 1. Increasing circumference/perimeter increases the arc traveled per degree of rotation. This can be compensated for on a circle by making the rotational steps inversely proportional to the circumference. 2. But, for an ellipse, that ratio is constantly changing. That type of calculation seemed daunting to me and I was unwilling to compromise on getting an exact fill (no overlaps, no gaps) so I used a method that never takes a step that is larger then 1 pixel. On my laptop, the 100 ellipse get rendered in, on average, about 0.4 seconds. That includes the overhead of calling the (parameter heavy) custom block.

Project Details

Project ID985893545
CreatedMarch 19, 2024
Last ModifiedMarch 23, 2024
SharedMarch 21, 2024
Visibilityvisible
CommentsAllowed