aboutsummaryrefslogtreecommitdiff
path: root/hitable.go
diff options
context:
space:
mode:
Diffstat (limited to 'hitable.go')
-rw-r--r--hitable.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/hitable.go b/hitable.go
index 1443110..ed18a5d 100644
--- a/hitable.go
+++ b/hitable.go
@@ -19,7 +19,7 @@ type Sphere struct {
}
func (sphere Sphere) Normal(point Vec3D) Vec3D {
- return (SubVec3D(point, sphere.center)).Unit()
+ return SubVec3D(point, sphere.center).Unit()
}
func (sphere Sphere) Hit(ray Ray) HitRecord {
@@ -31,7 +31,7 @@ func (sphere Sphere) Hit(ray Ray) HitRecord {
if discriminant < 0 {
return HitRecord{}
}
- time := (-b - math.Sqrt(discriminant)) / 2.0 / a
+ time := (-b - math.Sqrt(discriminant)) / (2.0 * a)
point := ray.PointAt(time)
- return HitRecord{time, point, SubVec3D(point, sphere.Normal(point))}
+ return HitRecord{time, point, sphere.Normal(point)}
}