public void CreatePlaneCoordinateSystemTest_WhenCoordinateSystemIsCalledWithOffsetAndNormal_ThenTranslationIsOffsetAndEzIsNormal() { var normal = new Vector3D(1.0, 1.0, 1.0).Normalize(); var offset = new Position3D(2, 3, 4); var mat = Matrix44D.CreatePlaneCoordinateSystem(offset, normal); Assert.Equal(offset, mat.Offset); Assert.Equal(offset.ToVector3D(), mat.Translation); Assert.Equal(normal, mat.Ez); Assert.Equal(0.0, mat.Ex * mat.Ey, ConstantsMath.Precision); Assert.Equal(0.0, mat.Ey * mat.Ez, ConstantsMath.Precision); Assert.Equal(0.0, mat.Ez * mat.Ex, ConstantsMath.Precision); }
public void CreateCoordinateSystemTest_WhenCoordinateSystemIsCalledWithExEyEzAndTranslation_ThenExEyEzAndTranslationAreEqualToParameters() { var ex = new Vector3D(1.0, 0.0, 0.0); var ey = new Vector3D(0.0, 0.0, -1.0); var ez = new Vector3D(-1.0, 1.0, 0.0); var offset = new Position3D(2, 3, 4); var mat = Matrix44D.CreateCoordinateSystem(offset, ex, ey, ez); Assert.Equal(ex, mat.Ex); Assert.Equal(ey, mat.Ey); Assert.Equal(ez, mat.Ez); Assert.Equal(offset, mat.Offset); Assert.Equal(offset.ToVector3D(), mat.Translation); }
public void CreatePlaneCoordinateSystemTest_WhenCoordinateSystemIsCalledWithOffsetAndTwoPlaneVectors_ThenTranslationIsOffsetAndEzIsNormal() { var first = new Vector3D(1.0, 1.0, 0.0).Normalize(); var second = new Vector3D(1.0, -1.0, 0.0).Normalize(); var offset = new Position3D(2, 3, 4); var mat = Matrix44D.CreatePlaneCoordinateSystem(offset, first, second); var expectedNormal = (first & second).Normalize(); Assert.Equal(offset, mat.Offset); Assert.Equal(offset.ToVector3D(), mat.Translation); Assert.Equal(expectedNormal, mat.Ez); Assert.Equal(0.0, mat.Ex * mat.Ey, ConstantsMath.Precision); Assert.Equal(0.0, mat.Ey * mat.Ez, ConstantsMath.Precision); Assert.Equal(0.0, mat.Ez * mat.Ex, ConstantsMath.Precision); }
public void ExEyEzTranslationTest_WhenMatrixIsCreated_ThenExEyEzAndTranslationAreColumnsOfMatrix() { var mat = new Matrix44D(1.1, 1.2, 1.3, 1.4, 2.1, 2.2, 2.3, 2.4, 3.1, 3.2, 3.3, 3.4, 0.0, 0.0, 0.0, 1.0); var expectedEx = new Vector3D(1.1, 2.1, 3.1); var expectedEy = new Vector3D(1.2, 2.2, 3.2); var expectedEz = new Vector3D(1.3, 2.3, 3.3); var expectedOffset = new Position3D(1.4, 2.4, 3.4); Assert.Equal(expectedEx, mat.Ex); Assert.Equal(expectedEy, mat.Ey); Assert.Equal(expectedEz, mat.Ez); Assert.Equal(expectedOffset, mat.Offset); Assert.Equal(expectedOffset.ToVector3D(), mat.Translation); }