diff options
| author | Martin Lehoux <martin@lehoux.net> | 2020-04-04 16:46:06 -0700 |
|---|---|---|
| committer | Martin Lehoux <martin@lehoux.net> | 2020-04-04 16:46:06 -0700 |
| commit | 1e77295876e20702d5ccb477b2f01df980723f04 (patch) | |
| tree | 0483f7485f48f38baa49a2b3b33efa12a364ed71 /hitable.go | |
| parent | 1008f463687a373f5c5d4024d25a09125b6c49ec (diff) | |
feat - sphere colors
Diffstat (limited to 'hitable.go')
| -rw-r--r-- | hitable.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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)} } |
