I have an ArrayList with Vec3D's in it. I want to break it off into chunks of 16 items each, and then connect the points to build a curve.
CurveData.TXT is a text file with points separated by commas. in x,y,z format 272 lines total. I want to use the first 16 points to draw a curve, the next chunk of 16 points to draw the next curve, and so on. I'm reading the txt file and putting the data into an arraylist of Vec3D in the setup:
Vec3D a = new Vec3D(coord[0], coord[1], coord[2]);
myPoints.add(a);
}
Then, I want to get the chunks like this:
void drawCurveData() {
int numberOfCurves=int(myPoints.size()/16);
int numberOfPointsIncurve = 16;
/*
for (int i=0; i<myPoints.size();i++) {
Vec3D a = (Vec3D) myPoints.get(i);
stroke(50, 125, 125);
strokeWeight(3);
point(a.x,a.y,a.z);
}*/
for (int i = 1; i<numberOfCurves;i++) {
Spline3D[] = new Spline3D[numberOfCurves];
for (int j=1; j<numberOfCurves;j++) {
Vec3D vert = (Vec3D) myPoints.get((i*j)-1);
Spline3D[i].add(vert);
}
}
}
I know my approach is flawed. I haven't even seen an array of Spline3D's yet. Although I think it should be easy to break that ArrayList up into discrete chunks of equal size. All I want is to draw each curve independently.
Any other approach is welcome. Again, the objective is to break the ist into chunks, in order to draw the curves independently.