A bit less allocation

This commit is contained in:
Smaug123
2023-05-07 00:01:03 +01:00
parent b2df9db225
commit fe31792cdd
2 changed files with 5 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ module InfinitePlane =
let s =
tangentComponent
|> Ray.walkAlong (Ray.make (Ray.walkAlong (Ray.make plane.Point plane.V1) normalComponent) plane.V2)
|> Ray.walkAlongRay (Ray.walkAlongRay plane.Point plane.V1 normalComponent) plane.V2
Point.differenceToThenFrom s strikePoint
|> Ray.make' strikePoint
@@ -63,7 +63,7 @@ module InfinitePlane =
while obj.ReferenceEquals (outgoing, null) do
let offset = UnitVector.random rand (Point.dimension pointOnPlane)
let sphereCentre = Ray.walkAlong pureOutgoing 1.0
let target = Ray.walkAlong (Ray.make sphereCentre offset) (fuzz / 1.0<fuzz>)
let target = Ray.walkAlongRay sphereCentre offset (fuzz / 1.0<fuzz>)
let output = Point.differenceToThenFrom target strikePoint |> Ray.make' strikePoint
match output with
@@ -77,9 +77,9 @@ module InfinitePlane =
| InfinitePlaneStyle.LambertReflection (albedo, colour, rand) ->
let outgoing =
let sphereCentre = Ray.walkAlong (Ray.make strikePoint normal) 1.0
let sphereCentre = Ray.walkAlongRay strikePoint normal 1.0
let offset = UnitVector.random rand (Point.dimension pointOnPlane)
let target = Ray.walkAlong (Ray.make sphereCentre offset) 1.0
let target = Ray.walkAlongRay sphereCentre offset 1.0
Point.differenceToThenFrom target strikePoint
|> Ray.make' strikePoint

View File

@@ -136,7 +136,7 @@ module Sphere =
let outgoingCos = sqrt (1.0 - outgoingSin * outgoingSin)
let outgoingPoint =
Ray.walkAlong (Ray.make (Ray.walkAlong normal (-outgoingCos)) plane.V2) outgoingSin
Ray.walkAlongRay (Ray.walkAlong normal (-outgoingCos)) plane.V2 outgoingSin
let outgoingLine = Point.differenceToThenFrom outgoingPoint strikePoint