Return a normalized vector from compute_normal

This commit is contained in:
Eryn Wells 2013-09-11 22:03:36 -07:00
parent 3646fa40ab
commit 1e39776145

View file

@ -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;
}