Return a normalized vector from compute_normal
This commit is contained in:
parent
3646fa40ab
commit
1e39776145
1 changed files with 3 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue