We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hi , I just wanted to make a curveVertex through the path of my PVector which is moving . here's the code : ( I just dont know how to give Location of PVector in a frame before current frame)
PVector loc;
PVector vel;
PVector acc;
void setup(){
size(1280,720);
smooth();
loc = new PVector (width/2,height/2);
vel = new PVector (0,0);
acc = new PVector (.01,0);
}
void draw(){
acc = PVector.random2D();
vel.add(acc);
loc.add(vel);
acc.limit(1);
noFill();
beginShape();
curveVertex(loc.x,loc.y);
////////////////////////
endShape();
}
Answers
Hi,
For draw a curveVertex, you need at least 4 vertices. The first and last aren't drawn, they use for compute the tangent on the second and (n-1) vertices. For that you need memorised the old position. For exemple
But the curve can go out of window...
Yea I got it ! thanx man !
also wrote this to check for edges :