Circular Trajectory / Orbit
My initial idea was to have a series of small ellipses traveling around a large circular trajectory at different speeds, so as to create patterns around the trajectory.
I thought a elliptical orbit was a simple enough concept that I could knock out fairly quickly and then spend time creating interesting patterns and interactions.
Not the case.
rotate() v Parametric Equations
Initially I used rotate() to move the ellipses. But this was limiting. It seemed that this would rotate everything in the canvas as I added new elements.
The solution I came up with was to define the rotation of the orbital ellipses around the circumference of a circle. To do this I would need an equation that would map every point around the circumference of a given circle. I did some research and discovered parametric equations.
These are the complementary equations I used :
x = (cx)+xr*cos(a)
y = (cy)+yr*sin(a)
- x: the x-cooridinate of a given circumference point
- y: the y-coordinate of the same point
- cx: the x-coordinate of the ellipse’s origin point
- cy: the y-coordinate of the ellipse’s origin point
- yr/xr: radius of the given ellipse
- a: measured angle
Here is the final sketch:
This theoretically allows me to have objects orbit independently of each other; i.e. I don’t have to rotate the entire canvas to create an orbital motion. So in the future I’ll be exploring implementing multiple independent orbits, relational orbits, and parametric equations that describe other shapes besides a ellipse/circle.