diff options
author | Nat Lasseter <user@4574.co.uk> | 2024-06-27 15:43:38 +0100 |
---|---|---|
committer | Nat Lasseter <user@4574.co.uk> | 2024-06-27 15:43:38 +0100 |
commit | 9e67a8260fee8f8a423a3131bcf13db3b9de6922 (patch) | |
tree | 472a4dfccc2d4e1cf8ba72d3eed509f8cced6878 /hittable.go | |
parent | 2211a942161d6509421915996f4351419adb990f (diff) |
maths.Pow turned out to be seriously terrible
Diffstat (limited to 'hittable.go')
-rw-r--r-- | hittable.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hittable.go b/hittable.go index ac5e996..73e2e3c 100644 --- a/hittable.go +++ b/hittable.go @@ -42,8 +42,8 @@ func (s Sphere) Hit(r Ray, ray_t Interval) (rec HitRecord) { oc := s.Origin.Sub(r.Origin); a := r.Direction.MagSqr(); h := r.Direction.Dot(oc); - c := oc.MagSqr() - maths.Pow(s.Radius, 2); - disc := maths.Pow(h, 2) - a*c; + c := oc.MagSqr() - s.Radius * s.Radius; + disc := h * h - a * c; if disc < 0 { return; |