src/shapes/sphere.cpp
// Return the normal in world coordinates
// Pre condition: the point passed as argument to this function is in
// world coordinates and belongs to the sphere

Return the normal in world coordinates
Pre condition: the point passed as argument to this function is in
world coordinates and belongs to the sphere
Return the normal in world coordinates Pre condition : the point passed as argument to this function is in world coordinates and belongs to the sphere
Vector3D Sphere::getNormalWorld(const Vector3D &pt_world) const
{
    Vector3D pt_local = worldToObject.transformPoint(pt_world);
    Vector3D n(pt_local.x, pt_local.y, pt_local.z);
    Matrix4x4 inverseTransposed;
    worldToObject.transpose(inverseTransposed);
    Vector3D nWorld = inverseTransposed.transformVector(n);
    return(nWorld.normalized());
}
Vector3D Sphere :: getNormalWorld ( const Vector3D & pt_world ) const { Vector3D pt_local = worldToObject . transformPoint ( pt_world ) ; Vector3D n ( pt_local . x , pt_local . y , pt_local . z ) ; Matrix4x4 inverseTransposed ; worldToObject . transpose ( inverseTransposed ) ; Vector3D nWorld = inverseTransposed . transformVector ( n ) ; return ( nWorld . normalized ( ) ) ; }
Return the normal in world coordinates
Pre condition: the point passed as argument to this function is in
world coordinates and belongs to the sphere
Return the normal in world coordinates Pre condition : the point passed as argument to this function is in world coordinates and belongs to the sphere
// Transform the point to local coordinates
 //Point3D pt_local = worldToObject.applyTransform(pt_world);
 // Normal in local coordinates
 //Normal n(pt_local.x, pt_local.y, pt_local.z);
 // Transform the normal to world coordinates
 //Normal nWorld = objectToWorld.applyTransform(n);
 // Multiply the normal by the transpose of the inverse
 // Check whether applying the transform to a normalized
 // normal allways yields a normalized normal
