@Test public void testHashCode() throws Exception { Random random = new Random(763); for (int i = 0; i < ITERATIONS; i++) { Vector4D expected = EuclidCoreRandomTools.nextVector4D(random); expected.scale(1.0e15); FrameVector4D actual = new FrameVector4D(worldFrame, expected); assertEquals(expected.hashCode(), actual.hashCode()); } }
@Test public void testGeometricallyEquals() throws Exception { Random random = new Random(32120); for (int i = 0; i < ITERATIONS; i++) { FrameVector4D frameVector1 = EuclidFrameRandomTools.nextFrameVector4D(random, worldFrame); FrameVector4D frameVector2 = new FrameVector4D(worldFrame); double epsilon = random.nextDouble(); Vector4D difference; difference = EuclidCoreRandomTools.nextVector4D(random); difference.scale(0.99 * epsilon / difference.norm()); frameVector2.add(frameVector1, difference); assertTrue(frameVector1.geometricallyEquals(frameVector2, epsilon)); difference = EuclidCoreRandomTools.nextVector4D(random); difference.scale(1.01 * epsilon / difference.norm()); frameVector2.add(frameVector1, difference); assertFalse(frameVector1.geometricallyEquals(frameVector2, epsilon)); } }
@Test public void testTransformVector4D() throws Exception { Random random = new Random(34534L); RotationScaleMatrix rotationScaleMatrix = EuclidCoreRandomTools.nextRotationScaleMatrix(random, 10.0); Vector4D originalVector = EuclidCoreRandomTools.nextVector4D(random); Vector4D actualVector = new Vector4D(); Vector4D expectedVector = new Vector4D(); expectedVector.set(originalVector); expectedVector.scale(rotationScaleMatrix.getScaleX(), rotationScaleMatrix.getScaleY(), rotationScaleMatrix.getScaleZ(), 1.0); rotationScaleMatrix.getRotationMatrix().transform(expectedVector, expectedVector); rotationScaleMatrix.transform(originalVector, actualVector); EuclidCoreTestTools.assertTuple4DEquals(expectedVector, actualVector, EPS); }
d2B2Dot.set(d2); d3B3Dot.set(d3); d1B1Dot.scale(0.5 * cumulativeBeziersDot[1].getDoubleValue()); d2B2Dot.scale(0.5 * cumulativeBeziersDot[2].getDoubleValue()); d3B3Dot.scale(0.5 * cumulativeBeziersDot[3].getDoubleValue()); d1B1DDot.scale(0.5 * cumulativeBeziersDDot[1].getDoubleValue()); d2B2DDot.scale(0.5 * cumulativeBeziersDDot[2].getDoubleValue()); d3B3DDot.scale(0.5 * cumulativeBeziersDDot[3].getDoubleValue());