1

I'm working on a method of visualizing solids of revolution in 3D using Processing. Currently, I'm able to draw all 3 axes, revolving around the Y as well as the shape I want to revolve around one of the axes.

I want to clear the axes from the screen each time so that they look like they're rotating in each frame, but I don't want to clear the shape from rotating as that is needed to create the solid of revolution visual. Not sure how to do this - any ideas?

Here's my current draw loop:

void draw() {
  background(0);
  camera(width/2.0, map(mouseY,0,height,-height/2 - PADDING ,height/2 + PADDING), (height/2.0) / tan(PI*30.0 / 180.0), 
  width/2.0, height/2.0, 0, 0, 1, 1);
  translate(width/2,height/2);

  rotateY(inc);

  pushMatrix();
  rotateY(inc2);
  shape(plotFunc());
  popMatrix();
  
  plotAxes();

  inc2 += 0.1;  
  inc += 0.010;    
} //draw;
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
sudhan
  • 48
  • 3
  • You could push each rotation of the shape, so on every draw, you can clear everything, draw axis one time, draw each and every rotation you have so far? – cSharp May 03 '22 at 00:14

0 Answers0