Skip to content

Instantly share code, notes, and snippets.

@spockz
Created April 30, 2011 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spockz/950045 to your computer and use it in GitHub Desktop.
Save spockz/950045 to your computer and use it in GitHub Desktop.
void update(Vector3 position, Vector3 speed, float dt){
Vector3 displacement = new Vector3(speed);
displacement.assignMul(dt);
position.assignAdd(displacement);
}
/*
This might provide a better abstraction over what you want to do.
If you can fix this in your EDSL together with the semantics, you
may do analysis on the computation you are building so that in
the end you can write your `inlined' function.
*/
void update(Vector3 position, Vector3 speed, float dt){
position.assign(position.add(speed.mul(dt)));
}
public Vector3 mul(int m) {
x *= m
y *= m
z *= m
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment