Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final Vector rotateAroundAxisX(Vector v, double angle) {
- double y, z, cos, sin;
- cos = Math.cos(angle);
- sin = Math.sin(angle);
- y = v.getY() * cos - v.getZ() * sin;
- z = v.getY() * sin + v.getZ() * cos;
- return v.setY(y).setZ(z);
- }
- public static final Vector rotateAroundAxisY(Vector v, double angle) {
- double x, z, cos, sin;
- cos = Math.cos(angle);
- sin = Math.sin(angle);
- x = v.getX() * cos + v.getZ() * sin;
- z = v.getX() * -sin + v.getZ() * cos;
- return v.setX(x).setZ(z);
- }
- public static final Vector rotateAroundAxisZ(Vector v, double angle) {
- double x, y, cos, sin;
- cos = Math.cos(angle);
- sin = Math.sin(angle);
- x = v.getX() * cos - v.getY() * sin;
- y = v.getX() * sin + v.getY() * cos;
- return v.setX(x).setY(y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement