From 9e67a8260fee8f8a423a3131bcf13db3b9de6922 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Thu, 27 Jun 2024 15:43:38 +0100 Subject: maths.Pow turned out to be seriously terrible --- hittable.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hittable.go') 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; -- cgit v1.2.1