2
« on: February 16, 2013, 03:18:59 pm »
Hi Helge and the jpct community.
first of all i would excuse me caus im no an expert poster, so i ask you to be kind in teaching me some.
im trying to code a ball game like tilt. im posting it soon if i can omn the forum.
i came across some code errors
SimpleVector copy = globalPos;
updateGlobalPos(); // or updateGlobalPos(globalPos)
this code affects copy as well. I understood i can not assign vectors as strings. To me it could be better to have a clone() and a equals() method in class.
example 2:
float maxKnot = 12.f;
public void interpolate(SimpleVector p1, SimpleVector p2){
SimpleVector delta = new SimpleVector(p1.x,p1.y,p1.z);
delta.sub(p2);
for ( int i = maxKnot ; i >0 ; i--){
SimpleVector temp= new SimpleVector(delta.x,delta.y,delta.z);
temp.scalarMul( i / maxKnot);
temp.add(p2);
points.add(temp);
}
}
to me that should look like this:
public void interpolate(SimpleVector p1, SimpleVector p2){
p1.sub(p2);
for ( int i = maxKnot ; i >0 ; i--){
SimpleVector delta = p1.clone().scalarMul( alfa ).add(p2);
points.add( delta );
it could be far better if we can add vectors the math style, as in c++ or as vertexShaders code.