I need know vertex after rotate

Something else I tried…

This is rotating shape and updating co-ordinates.
I had to rotate the PVector of the vertex.

PShape s;
float theta;

void setup() 
  {
  size(600, 600, P2D);
  s = createShape();
  s.beginShape(QUADS);
  s.vertex(0, 0);
  s.vertex(160, 0);
  s.vertex(160, 160);
  s.vertex(0, 160);
  s.endShape(CLOSE);
  
  fill(0);
  textAlign(CENTER);
  textSize(16);
  }

void draw() 
  {
  background(255);
  translate(width/2, height/2);
//  theta += TAU/100;
  for (int i = 0; i < s.getVertexCount(); i++) 
    {
    PVector v = s.getVertex(i);
    v.rotate(TAU/1000);
    s.setVertex(i, v);
    
    text(i, v.x+10, v.y);
    text(v.x, v.x-30, v.y-20);
    text(v.y, v.x+30, v.y-20);
    }
    
    shape(s);
  }

:slight_smile:

2 Likes