diff options
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; |