Java Code Examples for org.joml.Vector3f#rotate()

The following examples show how to use org.joml.Vector3f#rotate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Rotate3f.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void compute(final Vector3f v, final Quaternionfc q,
	final Vector3f vDot)
{
	vDot.set(v);
	vDot.rotate(q);
}
 
Example 2
Source File: Rotate3fTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testAxisAngle() {
	final Vector3f xAxis = new Vector3f(1, 0, 0);
	final Vector3f in = new Vector3f(xAxis);
	final AxisAngle4f axisAngle = new AxisAngle4f((float) (Math.PI / 2.0), 0, 0,
		1);
	final Vector3f expected = xAxis.rotate(new Quaternionf(axisAngle));

	final Vector3f result = ops.linalg().rotate(in, axisAngle);

	assertEquals("Rotation is incorrect", expected, result);
}
 
Example 3
Source File: Rotate3fTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testMutate() {
	final Vector3f xAxis = new Vector3f(1, 0, 0);
	final Vector3f in = new Vector3f(xAxis);
	final Quaternionf q = new Quaternionf(new AxisAngle4f((float) (Math.PI /
		2.0), 0, 0, 1));
	final Vector3f expected = xAxis.rotate(q);

	final Vector3f result = ops.linalg().rotate1(in, q);

	assertSame("Mutate should operate on the input object", in, result);
	assertEquals("Rotation is incorrect", expected, result);
}
 
Example 4
Source File: Rotate3f.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void mutate1(final Vector3f v, final Quaternionfc q) {
	v.rotate(q);
}