Perfect reflection, and Lambert, for spheres and planes (#1)

This commit is contained in:
Patrick Stevens
2021-04-06 23:47:30 +01:00
committed by GitHub
parent 301976863f
commit eefaa92d0e
30 changed files with 1625 additions and 114 deletions

View File

@@ -0,0 +1,21 @@
namespace RayTracing.Test
open NUnit.Framework
open FsCheck
open RayTracing
[<TestFixture>]
module TestPlane =
[<Test>]
let ``Orthogonalise does make orthogonal vectors`` () =
let property (p : Plane<float>) : bool =
let orth = Plane.orthonormalise Num.float p |> Option.get
let v1, v2 = Plane.basis orth
Num.float.Equal (Vector.dot Num.float v1.Vector v2.Vector) Num.float.Zero
&& Num.float.Equal (Vector.dot Num.float v1.Vector v1.Vector) Num.float.One
&& Num.float.Equal (Vector.dot Num.float v2.Vector v2.Vector) Num.float.One
property
|> Prop.forAll (Arb.fromGen TestUtils.planeGen)
|> Check.QuickThrowOnFailure