feat(JOML): migrate RotationTest
import com.google.common.collect.Iterables;
import org.joml.Quaternionf;
+import org.joml.Quaternionfc;
+import org.joml.Vector3f;
import org.junit.jupiter.api.Test;
-import org.terasology.math.geom.Quat4f;
-import org.terasology.math.geom.Vector3f;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.terasology.joml.test.QuaternionAssert.assertEquals;
@@ -36,8 +36,8 @@ public void testRotateSideNone() {
@Test
public void testRotateSideYaw() {
Rotation rotation = Rotation.rotate(Yaw.CLOCKWISE_90);
- Quat4f rot = rotation.getQuat4f();
- Vector3f dir = rot.rotate(Side.FRONT.toDirection().getVector3f(), new Vector3f());
+ Quaternionfc rot = rotation.orientation();
+ Vector3f dir = rot.transform(Side.FRONT.toDirection().asVector3f(), new Vector3f());
assertEquals(Direction.inDirection(dir).toSide(), rotation.rotate(Side.FRONT));
assertEquals(Side.LEFT, Rotation.rotate(Yaw.CLOCKWISE_90).rotate(Side.FRONT));
@@ -59,8 +59,8 @@ public void testOrientation() {
@Test
public void testRotateSidePitch() {
Rotation rotation = Rotation.rotate(Pitch.CLOCKWISE_90);
- Quat4f rot = rotation.getQuat4f();
- Vector3f dir = rot.rotate(Side.FRONT.toDirection().getVector3f(), new Vector3f());
+ Quaternionfc rot = rotation.orientation();
+ Vector3f dir = rot.transform(Side.FRONT.toDirection().asVector3f(), new Vector3f());
assertEquals(Direction.inDirection(dir).toSide(), rotation.rotate(Side.FRONT));
assertEquals(Side.TOP, Rotation.rotate(Pitch.CLOCKWISE_90).rotate(Side.FRONT));
@@ -70,8 +70,8 @@ public void testRotateSidePitch() {
@Test
public void testRotateSideRoll() {
Rotation rotation = Rotation.rotate(Roll.CLOCKWISE_90);
- Quat4f rot = rotation.getQuat4f();
- Vector3f dir = rot.rotate(Side.TOP.toDirection().getVector3f(), new Vector3f());
+ Quaternionfc rot = rotation.orientation();
+ Vector3f dir = rot.transform(Side.TOP.toDirection().asVector3f(), new Vector3f());
assertEquals(Direction.inDirection(dir).toSide(), rotation.rotate(Side.TOP));
assertEquals(Side.LEFT, Rotation.rotate(Roll.CLOCKWISE_90).rotate(Side.TOP));
@@ -81,8 +81,8 @@ public void testRotateSideRoll() {
@Test
public void testRotateMixed() {
Rotation rotation = Rotation.rotate(Yaw.CLOCKWISE_180, Pitch.CLOCKWISE_90, Roll.CLOCKWISE_90);
- Quat4f rot = rotation.getQuat4f();
- Vector3f dir = rot.rotate(Side.FRONT.toDirection().getVector3f(), new Vector3f());
+ Quaternionfc rot = rotation.orientation();
+ Vector3f dir = rot.transform(Side.FRONT.toDirection().asVector3f(), new Vector3f());
assertEquals(Direction.inDirection(dir).toSide(), rotation.rotate(Side.FRONT));
}
