i didnt meant that.i meant,if we have a legth of array that is divides by three,the first three eg[0,1,3] put the same atribute,then[4,5,6],an other atribute and so on...
Here is an example. Adjust the size and multiple and you will see it will do what you want. The challenge for you is, can you do the same using less lines?
Kf
void setup() {
size(400, 400);
noLoop();
}
void draw() {
int multiple=5;
int myObjSize=23;
int[] x = new int[myObjSize];
for (int i = 0; i < myObjSize; i=i+multiple) { //Access each subgroup
for (int j=0; j<multiple; j++) { //Access each item per subgroup
if (i+j < myObjSize) { //In case "multiple" is not multiple of myObjSize aka. check for within bounds
//############################
x[i+j]=i; //HERE all items in same subgroup will have same value
//############################
}
}
}
//Now print result
for (int i = 0; i < myObjSize; i++)
println((i)+"\t"+x[i]);
}
hey,i dont understand it complete,maybe you can help me I have this code,I take the vertices,in a PVector array.I assume that the PVectors are in such a row that correspond to faces.The faces are triangles,that is 3 Pvectors each face.I want to put the same movement to every 3 Pvectors,so[0,1,2] one movement,[3,4,5] an other movement.
Answers
Check if the remainder of the division of the iterator by 3 is 0:
https://Processing.org/reference/modulo.html
i didnt meant that.i meant,if we have a legth of array that is divides by three,the first three eg[0,1,3] put the same atribute,then[4,5,6],an other atribute and so on...
Here is an example. Adjust the size and multiple and you will see it will do what you want. The challenge for you is, can you do the same using less lines?
Kf
hey,i dont understand it complete,maybe you can help me I have this code,I take the vertices,in a PVector array.I assume that the PVectors are in such a row that correspond to faces.The faces are triangles,that is 3 Pvectors each face.I want to put the same movement to every 3 Pvectors,so[0,1,2] one movement,[3,4,5] an other movement.
maybe as i understand it,after putting your code in the lines 117-119 Verts[i].x=Verts[x[i]].x+RanX and so on