Accessing an Array outside a For Loop
in
Programming Questions
•
7 months ago
However I can't access the array outside the for loop. Is there a better way of doing this?
Cheers
- float radius=50;
- int numPoints=20;
- float angle=TWO_PI/(float)numPoints;
- float x, y;
- float[] pointsX, pointsY;
- void setup() {
- size(300, 300);
- for(int i=0;i<numPoints;i++) {
- float[] pointsX = new float[numPoints];
- float[] pointsY = new float[numPoints];
- x = radius*sin(angle*i) + width/2;
- pointsX[i] = x;
- y = radius*cos(angle*i) + height/2;
- pointsY[i] = y;
- point(x , y);
- }
- }
1