/* * Cylindrical Coordinates * iPhi -> [0, 2*pi] * iTheta -> [0, 2] * * Spherical Coordinates * phi -> [-pi, pi] * theta -> [0, pi] */ size_t CylindricalProjectionMap::binFromDirection(const Vector3d& direction) const { // convert to cylindrical double phi = direction.getPhi() + M_PI; double theta = sin(M_PI_2 - direction.getTheta()) + 1; // to indices size_t iPhi = phi / sPhi; size_t iTheta = theta / sTheta; // interleave size_t bin = iTheta * nPhi + iPhi; return bin; }