This is a p5.js sketch inspired by the Coding Train’s Coding Challenge #8 on creating a Solar System modeled in 3D.

screenshot

It builds on the simpler 2D implementation.

In fact, it was implemented mostly via:

  • Refactor away direct knowledge of 2D nature of the system.
  • Add 3D Support as via an alternate renderer and vector generator.
    • Benefiting from the fact that p5.js Vector easily supports both 2D and 3D vectors.

Following the principle put forth by Kent Beck:

for each desired change, make the change easy (warning: this may be hard), then make the easy change

Controls

(No interactivity implemented yet).

References:

Links: