matrix rotat e

- Add rotateTo method for non-object vectors and directions
This commit is contained in:
Jozufozu 2025-02-02 12:09:45 -08:00
parent 357c116286
commit 92fff518cd

View file

@ -99,8 +99,16 @@ public interface Rotate<Self extends Rotate<Self>> {
}; };
} }
default Self rotateTo(float fromX, float fromY, float fromZ, float toX, float toY, float toZ) {
return rotate(new Quaternionf().rotateTo(fromX, fromY, fromZ, toX, toY, toZ));
}
default Self rotateTo(Vector3fc from, Vector3fc to) { default Self rotateTo(Vector3fc from, Vector3fc to) {
return rotate(new Quaternionf().rotateTo(from, to)); return rotateTo(from.x(), from.y(), from.z(), to.x(), to.y(), to.z());
}
default Self rotateTo(Direction from, Direction to) {
return rotateTo(from.getStepX(), from.getStepY(), from.getStepZ(), to.getStepX(), to.getStepY(), to.getStepZ());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")