Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.Datatypes.MatrixTests
2 unit tests call DeltaEngine.Datatypes.Matrix.CreateRotationZYX(DeltaEngine.Datatypes.EulerAngles)
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- eulerAngles
- Type: DeltaEngine.Datatypes EulerAngles
Return Value
Type: MatrixRemarks
Examples
[Test] public void RotateMatrix() { var matrix1 = new Matrix(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1); var matrix2 = new Matrix(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1); var matrix3 = new Matrix(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); var matrix4 = matrix1 * (matrix2 * matrix3); Assert.IsTrue(matrix1.IsNearlyEqual(Matrix.CreateRotationZYX(90, 0, 0))); Assert.IsTrue(matrix2.IsNearlyEqual(Matrix.CreateRotationZYX(0, 90, 0))); Assert.IsTrue(matrix3.IsNearlyEqual(Matrix.CreateRotationZYX(0, 0, 90))); Assert.IsTrue(matrix4.IsNearlyEqual(Matrix.CreateRotationZYX(90, 90, 90))); }
[Test] public void TransformPosition() { var position = new Vector3D(3, 5, 2); var translation = Matrix.CreateTranslation(2, 0, 5); var rotation = Matrix.CreateRotationZYX(0, 90, 0); var scale = Matrix.CreateScale(3, 3, 3); var transformation = scale * rotation * translation; var result = translation * (rotation * (scale * position)); Assert.IsTrue((transformation * position).IsNearlyEqual(result)); }
See Also