use of org.spongepowered.api.util.transformation.Transformation in project SpongeCommon by SpongePowered.
the class TransformationTest method performRotationTest.
private Transformation performRotationTest(final Rotation rotation, final Vector3d original, final Vector3d expected, final Vector3d origin, final int rotateTimes) {
// given this builder
final SpongeTransformationBuilder transformationBuilder = new SpongeTransformationBuilder();
// when rotating
for (int i = 0; i < rotateTimes; ++i) {
transformationBuilder.rotate(rotation);
}
final Transformation transformation = transformationBuilder.origin(origin).build();
// then perform the transformation
final Vector3d result = transformation.transformPosition(original);
Assertions.assertEquals(expected, result, "Did not get expected rotation.");
return transformation;
}
Aggregations