Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Processing beinhaltet eine Vektor Klasse ‘PVector‘. PVector kann 2 oder 3 Dimensional sein.

PVector vec1 = new PVector(1,2);
PVector vec2 = new PVector(3,4);
 
println(vec1.x);
println(vec1.y);
println(vec1.z);
 
println(vec1);
println(vec2);
 
vec1.set(10,20);
println(vec1);
 
println("-- Vec Add --");
PVector resVec = PVector.add(vec1,vec2);
println(resVec);
 
vec1.add(vec2);
println(vec1);
 
println("-- Vec Sub --");
resVec = PVector.sub(vec1,vec2);
println(resVec);
 
vec1.sub(vec2);
println(vec1);
 
println("-- Vec Mult --");
resVec = PVector.mult(vec1,2);
println(resVec);
 
vec1.mult(2);
println(vec1);
 
println("-- Vec Length --");
println(vec1.mag());
 
println("-- Vec Angle Between --");
println(degrees(PVector.angleBetween(vec1, vec2)));
 
println("-- Vec Normalize --");
vec1.normalize();
println(vec1);
println(vec1.mag());