/** Convert physical position to UV projection * * @param pos :: position in 3D * @param u :: set to U * @param v :: set to V * @param uscale :: scaling for u direction * @param vscale :: scaling for v direction */ void UnwrappedCylinder::project(const Mantid::Kernel::V3D &pos, double &u, double &v, double &uscale, double &vscale) const { // projection to cylinder axis v = pos.scalar_prod(m_zaxis); double x = pos.scalar_prod(m_xaxis); double y = pos.scalar_prod(m_yaxis); u = applyUCorrection(-atan2(y, x)); uscale = 1. / sqrt(x * x + y * y); vscale = 1.; }
/** Convert physical position to UV projection * * @param u :: set to U * @param v :: set to V * @param uscale :: scaling for u direction * @param vscale :: scaling for v direction * @param pos :: position in 3D */ void UnwrappedSphere::project(double & u, double & v, double & uscale, double & vscale, const Mantid::Kernel::V3D & pos) const { // projection to cylinder axis v = pos.scalar_prod(m_zaxis); double x = pos.scalar_prod(m_xaxis); double y = pos.scalar_prod(m_yaxis); double r = sqrt(x*x+y*y+v*v); uscale = 1./sqrt(x*x+y*y); vscale = 1./r; u = applyUCorrection( -atan2(y,x) ); v = -acos(v/r); }