Increased delta bits and changed quaternion generator.
This commit is contained in:
parent
5c4ef39c92
commit
c64327b8a9
3 changed files with 18 additions and 5 deletions
|
@ -9,7 +9,7 @@ open OpenTK
|
||||||
[<AutoOpen>]
|
[<AutoOpen>]
|
||||||
module private AssertHelpers =
|
module private AssertHelpers =
|
||||||
[<Literal>]
|
[<Literal>]
|
||||||
let private BitAccuracy = 6
|
let private BitAccuracy = 9
|
||||||
|
|
||||||
let approxEq a b = MathHelper.ApproximatelyEqual(a,b,BitAccuracy)
|
let approxEq a b = MathHelper.ApproximatelyEqual(a,b,BitAccuracy)
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ module private Generators =
|
||||||
|
|
||||||
let quat =
|
let quat =
|
||||||
singleArb
|
singleArb
|
||||||
|> Gen.four
|
|> Gen.three
|
||||||
|> Gen.map Quaternion
|
|> Gen.map (fun (x,y,z) -> Quaternion(x,y,z,0.0f) |> Quaternion.Normalize)
|
||||||
|> Arb.fromGen
|
|> Arb.fromGen
|
||||||
|
|
||||||
let mat2 =
|
let mat2 =
|
||||||
|
|
|
@ -709,7 +709,7 @@ module Vector3 =
|
||||||
let transformedQuat = q * vectorQuat * inverse
|
let transformedQuat = q * vectorQuat * inverse
|
||||||
let transformedVector = transformedQuat.Xyz
|
let transformedVector = transformedQuat.Xyz
|
||||||
|
|
||||||
Assert.Equal(transformedVector, Vector3.Transform(v, q))
|
Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(v, q))
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Transformation by quaternion by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector3, q : Quaternion) =
|
let ``Transformation by quaternion by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector3, q : Quaternion) =
|
||||||
|
@ -719,4 +719,17 @@ module Vector3 =
|
||||||
let transformedQuat = q * vectorQuat * inverse
|
let transformedQuat = q * vectorQuat * inverse
|
||||||
let transformedVector = transformedQuat.Xyz
|
let transformedVector = transformedQuat.Xyz
|
||||||
|
|
||||||
Assert.Equal(transformedVector, Vector3.Transform(ref v, ref q))
|
Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(ref v, ref q))
|
||||||
|
|
||||||
|
[<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)
|
||||||
|
let inverse = Quaternion.Invert(q)
|
||||||
|
|
||||||
|
let transformedQuat = q * vectorQuat * inverse
|
||||||
|
let transformedVector = transformedQuat.Xyz
|
||||||
|
|
||||||
|
Assert.ApproximatelyEqual(v, transformedVector)
|
||||||
|
Assert.ApproximatelyEqual(v, Vector3.Transform(v, q))
|
||||||
|
Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(v, q))
|
Loading…
Reference in a new issue