//normalize a vector vector Ball::normalize(vector Vec) { vector tmp; tmp.x = Vec.x / vecMag(Vec); tmp.y = Vec.y / vecMag(Vec); return tmp; }
void FUNC_CALL_TYPE decart2SphiXZ(float4 dec, int32 * pLon, int32 * pLat, float * pRad) { float lonf; float latf; *pRad = vecMag(dec); lonf = D_RAD2DEG(atan2f(dec[0], dec[2])); latf = D_RAD2DEG(asinf(dec[1] / *pRad)); lonf = D_DEG2SPHI(lonf); latf = D_DEG2SPHI(latf); D_F2I_CAST(lonf, *pLon); D_F2I_CAST(latf, *pLat); }