My curveVertex() calls seem to not be drawing points at my intended location. Notice for each iteration of draw(), I call curveVertex(0,0), yet no spline begins from the top left of the entire canvas. Am I using curveVertex() incorrectly? I couldn’t find any other resource related to this issue. I reread the reference but didn’t see any relevant limitations.
Here is my draw() function:
void draw(){
beginShape();
int randomIndex = int(random(0, darkPixels.size()));
PData current = darkPixels.get(randomIndex);
boolean proceed = false;
while(!proceed){
newRandomIndex = int(random(0, darkPixels.size()));
PData randomPt = darkPixels.get(randomIndex);
if(abs(randomPt.x - current.x) <= 30 && abs(randomPt.y - current.y) <= 30){
goodx = randomPt.x;
goody = randomPt.y;
proceed = true;
archive = randomPt;
}
}
curveVertex(0,0);
curveVertex(current.x - int(random(0, 100)), current.y - int(random(0, 100)));
curveVertex(current.x, current.y);
curveVertex(goodx, goody);
curveVertex(archive.x + int(random(0, 500)), archive.y + int(random(0,500)));
endShape();
}
Note that PData is my own class that holds a brightness value, x coordinate, and y coordinate. Current and archive are PData objects.
Here is what my output looks like:
Thank you in advance for your help. I am looking forward to seeing what the issue is.