diff --git a/include/GWcsMER.hpp b/include/GWcsMER.hpp index d644bae..1de50a3 100644 --- a/include/GWcsMER.hpp +++ b/include/GWcsMER.hpp @@ -53,13 +53,13 @@ public: virtual ~GWcsMER(void); // Operators - GWcsMER& operator= (const GWcsMER& wcs); + GWcsMER& operator=(const GWcsMER& wcs); // Implemented pure virtual base class methods virtual void clear(void); virtual GWcsMER* clone(void) const; - virtual std::string code(void) const { return "MER"; } - virtual std::string name(void) const { return "Mercator's"; } + virtual std::string code(void) const; + virtual std::string name(void) const; virtual std::string print(const GChatter& chatter = NORMAL) const; private: @@ -76,4 +76,32 @@ private: double* x, double* y, int* stat) const; }; + +/***********************************************************************//** + * @brief Return projection code + * + * @return Projection code. + * + * Returns the projection code "MER". + ***************************************************************************/ +inline +std::string GWcsMER::code(void) const +{ + return "MER"; +} + + +/***********************************************************************//** + * @brief Return projection name + * + * @return Projection name. + * + * Returns the projection name. + ***************************************************************************/ +inline +std::string GWcsMER::name(void) const +{ + return "Mercator's"; +} + #endif /* GWCSMER_HPP */ diff --git a/include/GWcsSTG.hpp b/include/GWcsSTG.hpp index d17f6b8..e638d8a 100644 --- a/include/GWcsSTG.hpp +++ b/include/GWcsSTG.hpp @@ -28,6 +28,7 @@ #define GWCSSTG_HPP /* __ Includes ___________________________________________________________ */ +#include #include "GWcs.hpp" @@ -52,13 +53,13 @@ public: virtual ~GWcsSTG(void); // Operators - GWcsSTG& operator= (const GWcsSTG& wcs); + GWcsSTG& operator=(const GWcsSTG& wcs); // Implemented pure virtual base class methods virtual void clear(void); virtual GWcsSTG* clone(void) const; - virtual std::string code(void) const { return "STG"; } - virtual std::string name(void) const { return "stereographic"; } + virtual std::string code(void) const; + virtual std::string name(void) const; virtual std::string print(const GChatter& chatter = NORMAL) const; private: @@ -75,4 +76,32 @@ private: double* x, double* y, int* stat) const; }; + +/***********************************************************************//** + * @brief Return projection code + * + * @return Projection code. + * + * Returns the projection code "STG". + ***************************************************************************/ +inline +std::string GWcsSTG::code(void) const +{ + return "STG"; +} + + +/***********************************************************************//** + * @brief Return projection name + * + * @return Projection name. + * + * Returns the projection name. + ***************************************************************************/ +inline +std::string GWcsSTG::name(void) const +{ + return "stereographic"; +} + #endif /* GWCSSTG_HPP */ diff --git a/include/GWcsTAN.hpp b/include/GWcsTAN.hpp index 29a42e1..f0f99ba 100644 --- a/include/GWcsTAN.hpp +++ b/include/GWcsTAN.hpp @@ -28,6 +28,7 @@ #define GWCSTAN_HPP /* __ Includes ___________________________________________________________ */ +#include #include "GWcs.hpp" @@ -52,13 +53,13 @@ public: virtual ~GWcsTAN(void); // Operators - GWcsTAN& operator= (const GWcsTAN& wcs); + GWcsTAN& operator=(const GWcsTAN& wcs); // Implemented pure virtual base class methods virtual void clear(void); virtual GWcsTAN* clone(void) const; - virtual std::string code(void) const { return "TAN"; } - virtual std::string name(void) const { return "gnomonic"; } + virtual std::string code(void) const; + virtual std::string name(void) const; virtual std::string print(const GChatter& chatter = NORMAL) const; private: @@ -75,4 +76,32 @@ private: double* x, double* y, int* stat) const; }; + +/***********************************************************************//** + * @brief Return projection code + * + * @return Projection code. + * + * Returns the projection code "TAN". + ***************************************************************************/ +inline +std::string GWcsTAN::code(void) const +{ + return "TAN"; +} + + +/***********************************************************************//** + * @brief Return projection name + * + * @return Projection name. + * + * Returns the projection name. + ***************************************************************************/ +inline +std::string GWcsTAN::name(void) const +{ + return "gnomonic"; +} + #endif /* GWCSTAN_HPP */ diff --git a/src/sky/GWcsAIT.cpp b/src/sky/GWcsAIT.cpp index 08afbb2..e3862d3 100644 --- a/src/sky/GWcsAIT.cpp +++ b/src/sky/GWcsAIT.cpp @@ -34,7 +34,6 @@ #include "GWcsRegistry.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_PRJ_SET "GWcsAIT::prj_set()" #define G_PRJ_X2S "GWcsAIT::prj_x2s(int, int, int, int, double*, double*,"\ " double*, double*, int*)" #define G_PRJ_S2X "GWcsAIT::prj_s2x(int, int, int, int, double*, double*,"\ @@ -325,7 +324,7 @@ void GWcsAIT::prj_set(void) const /***********************************************************************//** - * @brief Cartesian-to-spherical deprojection + * @brief Pixel-to-spherical deprojection * * @param[in] nx X vector length. * @param[in] ny Y vector length (0=no replication). @@ -343,13 +342,13 @@ void GWcsAIT::prj_set(void) const * One or more of the (x,y) coordinates were invalid, as indicated * by the stat vector. * - * Deproject Cartesian (x,y) coordinates in the plane of projection to native + * Deproject pixel (x,y) coordinates in the plane of projection to native * spherical coordinates (phi,theta). * * This method has been adapted from the wcslib function prj.c::aitx2s(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, const double* x, const double* y, @@ -458,7 +457,7 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, /***********************************************************************//** - * @brief Generic spherical-to-Cartesian projection + * @brief Generic spherical-to-pixel projection * * @param[in] nphi Longitude vector length. * @param[in] ntheta Latitude vector length (0=no replication). @@ -476,13 +475,13 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, * One or more of the (phi,theta) coordinates were invalid, as * indicated by the stat vector. * - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) + * Project native spherical coordinates (phi,theta) to pixel (x,y) * coordinates in the plane of projection. * * This method has been adapted from the wcslib function prj.c::aits2x(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsAIT::prj_s2x(int nphi, int ntheta, int spt, int sxy, const double* phi, const double* theta, diff --git a/src/sky/GWcsAZP.cpp b/src/sky/GWcsAZP.cpp index 895a3a5..af74146 100644 --- a/src/sky/GWcsAZP.cpp +++ b/src/sky/GWcsAZP.cpp @@ -352,7 +352,7 @@ void GWcsAZP::prj_set(void) const /***********************************************************************//** - * @brief Cartesian-to-spherical deprojection + * @brief Pixel-to-spherical deprojection * * @param[in] nx X vector length. * @param[in] ny Y vector length (0=no replication). @@ -370,13 +370,13 @@ void GWcsAZP::prj_set(void) const * One or more of the (x,y) coordinates were invalid, as indicated * by the stat vector. * - * Deproject Cartesian (x,y) coordinates in the plane of projection to native + * Deproject pixel (x,y) coordinates in the plane of projection to native * spherical coordinates (phi,theta). * * This method has been adapted from the wcslib function prj.c::azpx2s(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, const double* x, const double* y, @@ -477,7 +477,7 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, /***********************************************************************//** - * @brief Generic spherical-to-Cartesian projection + * @brief Generic spherical-to-pixel projection * * @param[in] nphi Longitude vector length. * @param[in] ntheta Latitude vector length (0=no replication). @@ -495,13 +495,13 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, * One or more of the (phi,theta) coordinates were invalid, as * indicated by the stat vector. * - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) + * Project native spherical coordinates (phi,theta) to pixel (x,y) * coordinates in the plane of projection. * * This method has been adapted from the wcslib function prj.c::azps2x(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsAZP::prj_s2x(int nphi, int ntheta, int spt, int sxy, const double* phi, const double* theta, diff --git a/src/sky/GWcsCAR.cpp b/src/sky/GWcsCAR.cpp index 8731216..936f77f 100644 --- a/src/sky/GWcsCAR.cpp +++ b/src/sky/GWcsCAR.cpp @@ -336,7 +336,7 @@ void GWcsCAR::prj_set(void) const * This method has been adapted from the wcslib function prj.c::carx2s(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, const double* x, const double* y, @@ -410,7 +410,7 @@ void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, * This method has been adapted from the wcslib function prj.c::cars2x(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsCAR::prj_s2x(int nphi, int ntheta, int spt, int sxy, const double* phi, const double* theta, diff --git a/src/sky/GWcsMER.cpp b/src/sky/GWcsMER.cpp index 051da9d..380be61 100644 --- a/src/sky/GWcsMER.cpp +++ b/src/sky/GWcsMER.cpp @@ -70,7 +70,7 @@ GWcsMER::GWcsMER(void) : GWcs() /***********************************************************************//** - * @brief Constructor + * @brief Projection constructor * * @param[in] coords Coordinate system. * @param[in] crval1 X value of reference pixel. @@ -136,8 +136,9 @@ GWcsMER::~GWcsMER(void) * @brief Assignment operator * * @param[in] wcs World Coordinate System. + * @return World Coordinate System. ***************************************************************************/ -GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) +GWcsMER& GWcsMER::operator=(const GWcsMER& wcs) { // Execute only if object is not identical if (this != &wcs) { @@ -168,7 +169,7 @@ GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear Mercator's projection * * This method properly resets the object to an initial state. ***************************************************************************/ @@ -190,7 +191,9 @@ void GWcsMER::clear(void) /***********************************************************************//** - * @brief Clone instance + * @brief Clone Mercator's projection + * + * @return Pointer to deep copy of Mercator's projection. ***************************************************************************/ GWcsMER* GWcsMER::clone(void) const { @@ -202,7 +205,7 @@ GWcsMER* GWcsMER::clone(void) const * @brief Print WCS information * * @param[in] chatter Chattiness (defaults to NORMAL). - * @return String containing WCS information. + * @return String containing Mercator's projection information. ***************************************************************************/ std::string GWcsMER::print(const GChatter& chatter) const { @@ -295,7 +298,8 @@ void GWcsMER::prj_set(void) const m_r0 = gammalib::rad2deg; m_w.push_back(1.0); m_w.push_back(1.0); - } else { + } + else { m_w.push_back(m_r0 * gammalib::deg2rad); m_w.push_back(1.0/m_w[0]); } @@ -312,7 +316,7 @@ void GWcsMER::prj_set(void) const /***********************************************************************//** - * @brief Cartesian-to-spherical deprojection + * @brief Pixel-to-spherical deprojection * * @param[in] nx X vector length. * @param[in] ny Y vector length (0=no replication). @@ -326,13 +330,13 @@ void GWcsMER::prj_set(void) const * coordinates [deg]. * @param[out] stat Status return value for each vector element (always 0) * - * Deproject Cartesian (x,y) coordinates in the plane of projection to native + * Deproject pixel (x,y) coordinates in the plane of projection to native * spherical coordinates (phi,theta). * * This method has been adapted from the wcslib function prj.c::merx2s(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, const double* x, const double* y, @@ -386,7 +390,7 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, /***********************************************************************//** - * @brief Generic spherical-to-Cartesian projection + * @brief Generic spherical-to-pixel projection * * @param[in] nphi Longitude vector length. * @param[in] ntheta Latitude vector length (0=no replication). @@ -400,15 +404,14 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, * @param[out] y Vector of projected y coordinates. * @param[out] stat Status return value for each vector element (always 0) * - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) + * Project native spherical coordinates (phi,theta) to pixel (x,y) * coordinates in the plane of projection. * * This method has been adapted from the wcslib function prj.c::mers2x(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ -#define G_PRJ_X2S void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, const double* phi, const double* theta, double* x, double* y, int* stat) const @@ -472,10 +475,3 @@ void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ diff --git a/src/sky/GWcsSTG.cpp b/src/sky/GWcsSTG.cpp index 2cdb05a..876c6cc 100644 --- a/src/sky/GWcsSTG.cpp +++ b/src/sky/GWcsSTG.cpp @@ -34,8 +34,8 @@ #include "GWcsRegistry.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_PRJ_S2X "GWcsSTG::prj_s2x(int,int,int,int,double*,double*,double*,"\ - "double*,int*)" +#define G_PRJ_S2X "GWcsSTG::prj_s2x(int, int, int, int, double*, double*,"\ + " double*, double*, int*)" /* __ Macros _____________________________________________________________ */ @@ -72,7 +72,7 @@ GWcsSTG::GWcsSTG(void) : GWcs() /***********************************************************************//** - * @brief Constructor + * @brief Projection constructor * * @param[in] coords Coordinate system. * @param[in] crval1 X value of reference pixel. @@ -138,8 +138,9 @@ GWcsSTG::~GWcsSTG(void) * @brief Assignment operator * * @param[in] wcs World Coordinate System. + * @return World Coordinate System. ***************************************************************************/ -GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) +GWcsSTG& GWcsSTG::operator=(const GWcsSTG& wcs) { // Execute only if object is not identical if (this != &wcs) { @@ -170,7 +171,7 @@ GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear projection * * This method properly resets the object to an initial state. ***************************************************************************/ @@ -192,7 +193,9 @@ void GWcsSTG::clear(void) /***********************************************************************//** - * @brief Clone instance + * @brief Clone projection + * + * @return Pointer to deep copy of projection. ***************************************************************************/ GWcsSTG* GWcsSTG::clone(void) const { @@ -201,10 +204,10 @@ GWcsSTG* GWcsSTG::clone(void) const /***********************************************************************//** - * @brief Print WCS information + * @brief Print projection information * * @param[in] chatter Chattiness (defaults to NORMAL). - * @return String containing WCS information. + * @return String containing projection information. ***************************************************************************/ std::string GWcsSTG::print(const GChatter& chatter) const { @@ -274,7 +277,7 @@ void GWcsSTG::free_members(void) * @brief Setup of projection * * This method sets up the projection information. The method has been - * adapted from the wcslib function prj.c::carset. + * adapted from the wcslib function prj.c::stgset. * * Given and/or returned: * m_r0 Reset to 180/pi if 0. @@ -311,7 +314,7 @@ void GWcsSTG::prj_set(void) const /***********************************************************************//** - * @brief Cartesian-to-spherical deprojection + * @brief Pixel-to-spherical deprojection * * @param[in] nx X vector length. * @param[in] ny Y vector length (0=no replication). @@ -325,21 +328,22 @@ void GWcsSTG::prj_set(void) const * coordinates [deg]. * @param[out] stat Status return value for each vector element (always 0) * - * Deproject Cartesian (x,y) coordinates in the plane of projection to native + * Deproject pixel (x,y) coordinates in the plane of projection to native * spherical coordinates (phi,theta). * - * This method has been adapted from the wcslib function prj.c::carx2s(). + * This method has been adapted from the wcslib function prj.c::stgx2s(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, const double* x, const double* y, double* phi, double* theta, int* stat) const { // Initialize projection if required - if (!m_prjset) + if (!m_prjset) { prj_set(); + } // Set value replication length mx,my int mx; @@ -394,7 +398,7 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, /***********************************************************************//** - * @brief Generic spherical-to-Cartesian projection + * @brief Generic spherical-to-pixel projection * * @param[in] nphi Longitude vector length. * @param[in] ntheta Latitude vector length (0=no replication). @@ -408,21 +412,22 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, * @param[out] y Vector of projected y coordinates. * @param[out] stat Status return value for each vector element (always 0) * - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) + * Project native spherical coordinates (phi,theta) to pixel (x,y) * coordinates in the plane of projection. * - * This method has been adapted from the wcslib function prj.c::cars2x(). + * This method has been adapted from the wcslib function prj.c::stgs2x(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, const double* phi, const double* theta, double* x, double* y, int* stat) const { // Initialize projection if required - if (!m_prjset) + if (!m_prjset) { prj_set(); + } // Set value replication length mphi,mtheta int mphi; @@ -501,10 +506,3 @@ void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ diff --git a/src/sky/GWcsTAN.cpp b/src/sky/GWcsTAN.cpp index 0b10d22..3f19f1b 100644 --- a/src/sky/GWcsTAN.cpp +++ b/src/sky/GWcsTAN.cpp @@ -34,8 +34,8 @@ #include "GWcsRegistry.hpp" /* __ Method name definitions ____________________________________________ */ -#define G_PRJ_S2X "GWcsTAN::prj_s2x(int,int,int,int,double*,double*,double*,"\ - "double*,int*)" +#define G_PRJ_S2X "GWcsTAN::prj_s2x(int, int, int, int, double*, double*,"\ + " double*, double*, int*)" /* __ Macros _____________________________________________________________ */ @@ -72,7 +72,7 @@ GWcsTAN::GWcsTAN(void) : GWcs() /***********************************************************************//** - * @brief Constructor + * @brief Projection constructor * * @param[in] coords Coordinate system. * @param[in] crval1 X value of reference pixel. @@ -138,8 +138,9 @@ GWcsTAN::~GWcsTAN(void) * @brief Assignment operator * * @param[in] wcs World Coordinate System. + * @return World Coordinate System. ***************************************************************************/ -GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) +GWcsTAN& GWcsTAN::operator=(const GWcsTAN& wcs) { // Execute only if object is not identical if (this != &wcs) { @@ -170,9 +171,9 @@ GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) ==========================================================================*/ /***********************************************************************//** - * @brief Clear instance + * @brief Clear gnomonic projection * - * This method properly resets the object to an initial state. + * Resets the gnomonic projection to an clean initial state. ***************************************************************************/ void GWcsTAN::clear(void) { @@ -192,7 +193,9 @@ void GWcsTAN::clear(void) /***********************************************************************//** - * @brief Clone instance + * @brief Clone gnomonic projection + * + * @return Pointer to deep copy of gnomonic projection. ***************************************************************************/ GWcsTAN* GWcsTAN::clone(void) const { @@ -201,10 +204,10 @@ GWcsTAN* GWcsTAN::clone(void) const /***********************************************************************//** - * @brief Print WCS information + * @brief Print gnomonic projection information * * @param[in] chatter Chattiness (defaults to NORMAL). - * @return String containing WCS information. + * @return String containing gnomonic projection information. ***************************************************************************/ std::string GWcsTAN::print(const GChatter& chatter) const { @@ -274,7 +277,7 @@ void GWcsTAN::free_members(void) * @brief Setup of projection * * This method sets up the projection information. The method has been - * adapted from the wcslib function prj.c::carset. + * adapted from the wcslib function prj.c::tanset. * * Given and/or returned: * m_r0 Reset to 180/pi if 0. @@ -291,8 +294,9 @@ void GWcsTAN::prj_set(void) const m_w.clear(); // Precompute - if (m_r0 == 0.0) + if (m_r0 == 0.0) { m_r0 = gammalib::rad2deg; + } // Compute fiducial offset prj_off(0.0, 90.0); @@ -306,7 +310,7 @@ void GWcsTAN::prj_set(void) const /***********************************************************************//** - * @brief Cartesian-to-spherical deprojection + * @brief Pixel-to-spherical deprojection * * @param[in] nx X vector length. * @param[in] ny Y vector length (0=no replication). @@ -320,21 +324,22 @@ void GWcsTAN::prj_set(void) const * coordinates [deg]. * @param[out] stat Status return value for each vector element (always 0) * - * Deproject Cartesian (x,y) coordinates in the plane of projection to native + * Deproject pixel (x,y) coordinates in the plane of projection to native * spherical coordinates (phi,theta). * - * This method has been adapted from the wcslib function prj.c::carx2s(). + * This method has been adapted from the wcslib function prj.c::tanx2s(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, const double* x, const double* y, double* phi, double* theta, int* stat) const { // Initialize projection if required - if (!m_prjset) + if (!m_prjset) { prj_set(); + } // Set value replication length mx,my int mx; @@ -356,8 +361,9 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, for (int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) { double xj = *xp + m_x0; double* phip = phi + rowoff; - for (int iy = 0; iy < my; ++iy, phip += rowlen) + for (int iy = 0; iy < my; ++iy, phip += rowlen) { *phip = xj; + } } // Do y dependence @@ -371,10 +377,12 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, for (int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt) { double xj = *phip; double r = std::sqrt(xj*xj + yj2); - if (r == 0.0) + if (r == 0.0) { *phip = 0.0; - else + } + else { *phip = gammalib::atan2d(xj, -yj); + } *thetap = gammalib::atan2d(m_r0, r); *(statp++) = 0; } @@ -386,7 +394,7 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, /***********************************************************************//** - * @brief Generic spherical-to-Cartesian projection + * @brief Generic spherical-to-pixel projection * * @param[in] nphi Longitude vector length. * @param[in] ntheta Latitude vector length (0=no replication). @@ -400,21 +408,22 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, * @param[out] y Vector of projected y coordinates. * @param[out] stat Status return value for each vector element (always 0) * - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) + * Project native spherical coordinates (phi,theta) to pixel (x,y) * coordinates in the plane of projection. * - * This method has been adapted from the wcslib function prj.c::cars2x(). + * This method has been adapted from the wcslib function prj.c::tans2x(). * The interface follows very closely that of wcslib. In contrast to the * wcslib routine, however, the method assumes that the projection has been - * setup previsouly (as this will be done by the constructor). + * setup previously (as this will be done by the constructor). ***************************************************************************/ void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, const double* phi, const double* theta, double* x, double* y, int* stat) const { // Initialize projection if required - if (!m_prjset) + if (!m_prjset) { prj_set(); + } // Set value replication length mphi,mtheta int mphi; @@ -492,16 +501,10 @@ void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, } // Handle status code - if (status == 4) + if (status == 4) { throw GException::wcs_invalid_phi_theta(G_PRJ_S2X, n_invalid); + } // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/