20. Ellipse
Track the shape of an ellipse.
Step I: Setup
- The background is 400x300.
- There are blue circles centered at (50,150) and (350,150).
- The model is a posn.
- A purple circle follows your mouse.
Step II: Colors
This description will use two variables:
dA
: the distance from the model to the center of the left circledB
: the distance from the model to the center of the right circle
Measure the sum of the distances (dA+dB
). If that number is less
than 360, use a purple circle, but otherwise use an orange circle.
Example
Adding the lines and the good colors are optional. The ellipse shown
below is made with build-image
, but you could use a 360x200 ellipse.
![](/intermediate-cs/ch20/ellipse/ellipse-1.png)