Assert.Equal(transformedVector, Vector2.Transform(ref v, ref q))
+// TODO: Implement multiplication operator for Vector2 and Quaternion
+// [<Property>]
+// let ``Transformation by quaternion by multiplication using right-handed notation is the same as multiplication by quaternion and its conjugate`` (v : Vector2, q : Quaternion) =
+// let vectorQuat = Quaternion(v.X, v.Y, 0.0f, 0.0f)
+// let inverse = Quaternion.Invert(q)
+//
+// let transformedQuat = q * vectorQuat * inverse
+// let transformedVector = Vector2(transformedQuat.X, transformedQuat.Y)
+//
+// Assert.Equal(transformedVector, q * v)
+
[<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
module Serialization =
//
Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(ref v, ref q))
[<Property>]
+ let ``Transformation by quaternion by multiplication using right-handed notation is the same as multiplication by quaternion and its conjugate`` (v : Vector3, q : Quaternion) =
+ let vectorQuat = Quaternion(v.X, v.Y, v.Z, 0.0f)
+ let inverse = Quaternion.Invert(q)
+
+ let transformedQuat = q * vectorQuat * inverse
+ let transformedVector = transformedQuat.Xyz
+
+ Assert.ApproximatelyEqual(transformedVector, q * v)
+
+ [<Property>]
let ``Transformation by identity quaternion does not alter vector`` (v : Vector3) =
let q = Quaternion.Identity
let vectorQuat = Quaternion(v.X, v.Y, v.Z, 0.0f)
module Transformation =
//
[<Property>]
- let ``Transformation by quaternion is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) =
+ let ``Transformation by quaternion with static method is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) =
let vectorQuat = Quaternion(v.X, v.Y, v.Z, v.W)
let inverse = Quaternion.Invert(q)
Assert.Equal(transformedVector, Vector4.Transform(v, q))
[<Property>]
- let ``Transformation by quaternion by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) =
+ let ``Transformation by quaternion with static method by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) =
let vectorQuat = Quaternion(v.X, v.Y, v.Z, v.W)
let inverse = Quaternion.Invert(q)
let transformedQuat = q * vectorQuat * inverse
let transformedVector = Vector4(transformedQuat.X, transformedQuat.Y,transformedQuat.Z, transformedQuat.W)
- Assert.Equal(transformedVector, Vector4.Transform(ref v, ref q))
\ No newline at end of file
+ Assert.Equal(transformedVector, Vector4.Transform(ref v, ref q))
+
+ [<Property>]
+ let ``Transformation by quaternion by multiplication using right-handed notation is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) =
+ let vectorQuat = Quaternion(v.X, v.Y, v.Z, v.W)
+ let inverse = Quaternion.Invert(q)
+
+ let transformedQuat = q * vectorQuat * inverse
+ let transformedVector = Vector4(transformedQuat.X, transformedQuat.Y, transformedQuat.Z, transformedQuat.W)
+
+ Assert.Equal(transformedVector, q * v)
\ No newline at end of file