void TIESpherical(M3DVector3f rectangular, M3DVector3f spherical) { float rho = m3dGetVectorLengthf(rectangular); float theta = atan2f(rectangular[1], rectangular[0]) + M_PI; float phi = acosf(rectangular[2]/rho); spherical[0] = rho; spherical[1] = theta; spherical[2] = phi; }
void m3dNormalizeVectorf(M3DVector3f u) { m3dScaleVector3f(u, 1.0f / m3dGetVectorLengthf(u)); }