Пример #1
0
		public void Create()
		{
			var euler = new EulerAngles(1, 2, 3);
			Assert.AreEqual(euler.Pitch, 1);
			Assert.AreEqual(euler.Yaw, 2);
			Assert.AreEqual(euler.Roll, 3);
		}
Пример #2
0
		public void GetHashCodeViaDictionary()
		{
			var first = new EulerAngles(1, 2, 3);
			var second = new EulerAngles(3, 4, 5);
			var eulerAngles = new Dictionary<EulerAngles, int> { { first, 1 }, { second, 2 } };
			Assert.IsTrue(eulerAngles.ContainsKey(first));
			Assert.IsTrue(eulerAngles.ContainsKey(second));
			Assert.IsFalse(eulerAngles.ContainsKey(new EulerAngles(5, 6, 7)));
		}
Пример #3
0
		public void Equals()
		{
			var euler1 = new EulerAngles(1, 2, 3);
			var euler2 = new EulerAngles(3, 4, 5);
			Assert.AreNotEqual(euler1, euler2);
			Assert.AreEqual(euler1, new EulerAngles(1, 2, 3));
			Assert.IsTrue(euler1 == new EulerAngles(1, 2, 3));
			Assert.IsTrue(euler1 != euler2);
			Assert.IsTrue(euler1.Equals((object)new EulerAngles(1, 2, 3)));
		}
Пример #4
0
 public bool Equals(EulerAngles other)
 {
     return Pitch.IsNearlyEqual(other.Pitch) && Yaw.IsNearlyEqual(other.Yaw) &&
         Roll.IsNearlyEqual(other.Roll);
 }
Пример #5
0
 public static Matrix CreateRotationZYX(EulerAngles eulerAngles)
 {
     return(CreateRotationZYX(eulerAngles.Pitch, eulerAngles.Yaw, eulerAngles.Roll));
 }
Пример #6
0
		private static void VerifyEuler(EulerAngles eulerAngles)
		{
			var rotationMatrix = Matrix.CreateRotationZYX(eulerAngles);
			var rotationQuaternion = Quaternion.FromRotationMatrix(rotationMatrix);
			Assert.AreEqual(eulerAngles, rotationQuaternion.ToEuler());
		}
Пример #7
0
 public bool Equals(EulerAngles other)
 {
     return(Pitch.IsNearlyEqual(other.Pitch) && Yaw.IsNearlyEqual(other.Yaw) &&
            Roll.IsNearlyEqual(other.Roll));
 }