Tests the local space to world space conversion.
()
| 45 | /// Tests the local space to world space conversion. |
| 46 | /// </summary> |
| 47 | [Test] |
| 48 | public void TestLocalToWorld() |
| 49 | { |
| 50 | Transform t1 = new Transform(new Vector3(10, 1, 10), Quaternion.Euler(45, 0, -15), new Float3(1.5f, 0.5f, 0.1f)); |
| 51 | Transform t2 = new Transform(new Vector3(0, 20, 0), Quaternion.Euler(0, 0, 15), new Float3(1.0f, 2.0f, 1.0f)); |
| 52 | |
| 53 | Transform a1 = t1.LocalToWorld(t2); |
| 54 | Vector3 a2 = t1.LocalToWorld(t2.Translation); |
| 55 | |
| 56 | Vector3 a3; |
| 57 | { |
| 58 | Vector3 result; |
| 59 | Matrix scale, rotation, scaleRotation; |
| 60 | Matrix.Scaling(ref t1.Scale, out scale); |
| 61 | Matrix.RotationQuaternion(ref t1.Orientation, out rotation); |
| 62 | Matrix.Multiply(ref scale, ref rotation, out scaleRotation); |
| 63 | Vector3.Transform(ref t2.Translation, ref scaleRotation, out result); |
| 64 | a3 = result + t1.Translation; |
| 65 | } |
| 66 | |
| 67 | var a4T = new Vector3[1]; |
| 68 | t1.LocalToWorld(new Vector3[1] { t2.Translation }, a4T); |
| 69 | Vector3 a4 = a4T[0]; |
| 70 | |
| 71 | Assert.IsTrue(Vector3.NearEqual(a1.Translation, a2)); |
| 72 | Assert.IsTrue(Vector3.NearEqual(a2, a3)); |
| 73 | Assert.IsTrue(Vector3.NearEqual(a2, a4)); |
| 74 | } |
| 75 | |
| 76 | /// <summary> |
| 77 | /// Tests the world space to local space conversion. |
nothing calls this directly
no test coverage detected