Simple ArrayIndex problem

Hello,

Examine this very closely and you will understand:

PVector a = new PVector(0,0);
PVector b = new PVector(0,0);
  
translate(500, 500);
for(int i = 0; i < positions.size()-1; i++)
  {
  a = positions.get(i);
  b = positions.get(i+1);  // NEXT POINT - here is the problem-
  
  strokeWeight(2);
  line(a.x ,a.y, b.x, b.y);
  ellipse(a.x, a.y, 10, 10);
  }

ellipse(b.x, b.y, 10, 10);

:)

1 Like