-// calculate the projection of u along the direction of d.
-template<typename T>
-inline SGVec3<T> SGProjection(const SGVec3<T>& u, const SGVec3<T>& d)
-{
- T denom = dot(d, d);
- if (denom == 0.) return u;
- else return d * (dot(u,d) / denom);
-}
-