VectorField array question
in
Programming Questions
•
2 years ago
I cannot make an array with locations for the vectors without using a for loop. Because of the rest of the code I need to draw all the vectors (calculates apparently of the canvas size). Is it possible to set some 'null' (how?)?
Thanks for any help!
- for(i = 0; i < numVectors ; i++) {
- int x = i % w;
- int y = i / w;
- int loc = int(x + y * w);
- xoff += x*.0160 + .009;
- yoff += y*.0160 + .009;
- float angle = map(noise(xoff,yoff),0,1,0,TWO_PI);
- field[loc] = new PVector(cos(angle), sin(angle));
- }
I prefer something like this:
- field[0] [ -0.3936499, -0.91926044, 0.0 ];
- field[1] [ -0.38234037, -0.92402154, 0.0 ;]
- field[2] [ -0.36286467, -0.93184185, 0.0 ];
- etc.
But it doesn't work..
1