Orthogonal projection of a vector over a plane
From Director Online Wiki
Copy and paste on a movie script:
---------------------------------------- on orthoProjectVectorOnPlane vect, planeNormal -- calculates the projection (normal or orthogonal) of a free vector over a plane -- both parameters are vectors -- vect is the vector we want to project -- planeNormal is a vector normal to the plane that defines its orientation -- only returns void (error) if planeNormal is (0,0,0) -- otherwise, returns a vector -- by Iñigo de Gracia ---------------------------------------- if planeNormal.magnitude <> 1 then if planeNormal.magnitude = 0 then return void planeNormal.normalize() end if return planeNormal.cross(vect).cross (planeNormal) end --