From 1e397761459678e3923ddcd1dd7ca8c0952bf892 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 11 Sep 2013 22:03:36 -0700 Subject: [PATCH] Return a normalized vector from compute_normal --- src/object_sphere.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/object_sphere.cc b/src/object_sphere.cc index 5284b86..8dce41d 100644 --- a/src/object_sphere.cc +++ b/src/object_sphere.cc @@ -155,11 +155,8 @@ Vector3 Sphere::compute_normal(const Vector3 &p) const { - // Make sure the given point is actually on the surface of the sphere. - if (!point_is_on_surface(p)) { - return Vector3::Zero; - } - // The fun thing about sphere is the normal to any point on the sphere is the point itself. Woo! - return p - get_origin(); + Vector3 normal = p - get_origin(); + normal.normalize(); + return normal; }