Added test of multiplication operators.
This commit is contained in:
parent
c12eefa0cf
commit
0cd47f2c3c
3 changed files with 34 additions and 3 deletions
|
@ -574,6 +574,17 @@ module Vector2 =
|
|||
|
||||
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 =
|
||||
//
|
||||
|
|
|
@ -721,6 +721,16 @@ module Vector3 =
|
|||
|
||||
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
|
||||
|
|
|
@ -812,7 +812,7 @@ module Vector4 =
|
|||
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)
|
||||
|
||||
|
@ -822,11 +822,21 @@ module Vector4 =
|
|||
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))
|
||||
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)
|
Loading…
Reference in a new issue