Creating 3D animation with math expressions

Hello @aalgoro,

This topic may be of interest:

Code from above simplified:

void setup() 
  {
  size(800, 800, P3D);
  }

void draw() 
  {
  background(255);
  strokeWeight(5);
  
  translate(width/2, height/2);

  for (int i = 0; i < 300; i++) 
    {
    float x = width/4*sin(i*PI*2/100);
    float y = height/4*sin(i*PI*3/100);
    float z = 200*sin(i*PI*4/100);
    point(x, y, z);
    }
  }

Additional references:
https://processing.org/tutorials/trig

The above site is poorly formatted and this is cleaner:

x = cosine(theta)*radius 
y = sine(theta)*radius
float x = cos(radians(angle))*radius;
float y = sin(radians(angle))*radius;

Have fun!

:)

2 Likes