Commit eaddc45822a04cfd1c111eadce8f930281e5f3d4
1 parent
eafe6202
Minor revision of projection class interfaces.
Showing
9 changed files
with
184 additions
and
102 deletions
include/GWcsMER.hpp
| @@ -53,13 +53,13 @@ public: | @@ -53,13 +53,13 @@ public: | ||
| 53 | virtual ~GWcsMER(void); | 53 | virtual ~GWcsMER(void); |
| 54 | 54 | ||
| 55 | // Operators | 55 | // Operators |
| 56 | - GWcsMER& operator= (const GWcsMER& wcs); | 56 | + GWcsMER& operator=(const GWcsMER& wcs); |
| 57 | 57 | ||
| 58 | // Implemented pure virtual base class methods | 58 | // Implemented pure virtual base class methods |
| 59 | virtual void clear(void); | 59 | virtual void clear(void); |
| 60 | virtual GWcsMER* clone(void) const; | 60 | virtual GWcsMER* clone(void) const; |
| 61 | - virtual std::string code(void) const { return "MER"; } | ||
| 62 | - virtual std::string name(void) const { return "Mercator's"; } | 61 | + virtual std::string code(void) const; |
| 62 | + virtual std::string name(void) const; | ||
| 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; | 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 64 | 64 | ||
| 65 | private: | 65 | private: |
| @@ -76,4 +76,32 @@ private: | @@ -76,4 +76,32 @@ private: | ||
| 76 | double* x, double* y, int* stat) const; | 76 | double* x, double* y, int* stat) const; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | + | ||
| 80 | +/***********************************************************************//** | ||
| 81 | + * @brief Return projection code | ||
| 82 | + * | ||
| 83 | + * @return Projection code. | ||
| 84 | + * | ||
| 85 | + * Returns the projection code "MER". | ||
| 86 | + ***************************************************************************/ | ||
| 87 | +inline | ||
| 88 | +std::string GWcsMER::code(void) const | ||
| 89 | +{ | ||
| 90 | + return "MER"; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +/***********************************************************************//** | ||
| 95 | + * @brief Return projection name | ||
| 96 | + * | ||
| 97 | + * @return Projection name. | ||
| 98 | + * | ||
| 99 | + * Returns the projection name. | ||
| 100 | + ***************************************************************************/ | ||
| 101 | +inline | ||
| 102 | +std::string GWcsMER::name(void) const | ||
| 103 | +{ | ||
| 104 | + return "Mercator's"; | ||
| 105 | +} | ||
| 106 | + | ||
| 79 | #endif /* GWCSMER_HPP */ | 107 | #endif /* GWCSMER_HPP */ |
include/GWcsSTG.hpp
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | #define GWCSSTG_HPP | 28 | #define GWCSSTG_HPP |
| 29 | 29 | ||
| 30 | /* __ Includes ___________________________________________________________ */ | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | +#include <string> | ||
| 31 | #include "GWcs.hpp" | 32 | #include "GWcs.hpp" |
| 32 | 33 | ||
| 33 | 34 | ||
| @@ -52,13 +53,13 @@ public: | @@ -52,13 +53,13 @@ public: | ||
| 52 | virtual ~GWcsSTG(void); | 53 | virtual ~GWcsSTG(void); |
| 53 | 54 | ||
| 54 | // Operators | 55 | // Operators |
| 55 | - GWcsSTG& operator= (const GWcsSTG& wcs); | 56 | + GWcsSTG& operator=(const GWcsSTG& wcs); |
| 56 | 57 | ||
| 57 | // Implemented pure virtual base class methods | 58 | // Implemented pure virtual base class methods |
| 58 | virtual void clear(void); | 59 | virtual void clear(void); |
| 59 | virtual GWcsSTG* clone(void) const; | 60 | virtual GWcsSTG* clone(void) const; |
| 60 | - virtual std::string code(void) const { return "STG"; } | ||
| 61 | - virtual std::string name(void) const { return "stereographic"; } | 61 | + virtual std::string code(void) const; |
| 62 | + virtual std::string name(void) const; | ||
| 62 | virtual std::string print(const GChatter& chatter = NORMAL) const; | 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 63 | 64 | ||
| 64 | private: | 65 | private: |
| @@ -75,4 +76,32 @@ private: | @@ -75,4 +76,32 @@ private: | ||
| 75 | double* x, double* y, int* stat) const; | 76 | double* x, double* y, int* stat) const; |
| 76 | }; | 77 | }; |
| 77 | 78 | ||
| 79 | + | ||
| 80 | +/***********************************************************************//** | ||
| 81 | + * @brief Return projection code | ||
| 82 | + * | ||
| 83 | + * @return Projection code. | ||
| 84 | + * | ||
| 85 | + * Returns the projection code "STG". | ||
| 86 | + ***************************************************************************/ | ||
| 87 | +inline | ||
| 88 | +std::string GWcsSTG::code(void) const | ||
| 89 | +{ | ||
| 90 | + return "STG"; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +/***********************************************************************//** | ||
| 95 | + * @brief Return projection name | ||
| 96 | + * | ||
| 97 | + * @return Projection name. | ||
| 98 | + * | ||
| 99 | + * Returns the projection name. | ||
| 100 | + ***************************************************************************/ | ||
| 101 | +inline | ||
| 102 | +std::string GWcsSTG::name(void) const | ||
| 103 | +{ | ||
| 104 | + return "stereographic"; | ||
| 105 | +} | ||
| 106 | + | ||
| 78 | #endif /* GWCSSTG_HPP */ | 107 | #endif /* GWCSSTG_HPP */ |
include/GWcsTAN.hpp
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | #define GWCSTAN_HPP | 28 | #define GWCSTAN_HPP |
| 29 | 29 | ||
| 30 | /* __ Includes ___________________________________________________________ */ | 30 | /* __ Includes ___________________________________________________________ */ |
| 31 | +#include <string> | ||
| 31 | #include "GWcs.hpp" | 32 | #include "GWcs.hpp" |
| 32 | 33 | ||
| 33 | 34 | ||
| @@ -52,13 +53,13 @@ public: | @@ -52,13 +53,13 @@ public: | ||
| 52 | virtual ~GWcsTAN(void); | 53 | virtual ~GWcsTAN(void); |
| 53 | 54 | ||
| 54 | // Operators | 55 | // Operators |
| 55 | - GWcsTAN& operator= (const GWcsTAN& wcs); | 56 | + GWcsTAN& operator=(const GWcsTAN& wcs); |
| 56 | 57 | ||
| 57 | // Implemented pure virtual base class methods | 58 | // Implemented pure virtual base class methods |
| 58 | virtual void clear(void); | 59 | virtual void clear(void); |
| 59 | virtual GWcsTAN* clone(void) const; | 60 | virtual GWcsTAN* clone(void) const; |
| 60 | - virtual std::string code(void) const { return "TAN"; } | ||
| 61 | - virtual std::string name(void) const { return "gnomonic"; } | 61 | + virtual std::string code(void) const; |
| 62 | + virtual std::string name(void) const; | ||
| 62 | virtual std::string print(const GChatter& chatter = NORMAL) const; | 63 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 63 | 64 | ||
| 64 | private: | 65 | private: |
| @@ -75,4 +76,32 @@ private: | @@ -75,4 +76,32 @@ private: | ||
| 75 | double* x, double* y, int* stat) const; | 76 | double* x, double* y, int* stat) const; |
| 76 | }; | 77 | }; |
| 77 | 78 | ||
| 79 | + | ||
| 80 | +/***********************************************************************//** | ||
| 81 | + * @brief Return projection code | ||
| 82 | + * | ||
| 83 | + * @return Projection code. | ||
| 84 | + * | ||
| 85 | + * Returns the projection code "TAN". | ||
| 86 | + ***************************************************************************/ | ||
| 87 | +inline | ||
| 88 | +std::string GWcsTAN::code(void) const | ||
| 89 | +{ | ||
| 90 | + return "TAN"; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +/***********************************************************************//** | ||
| 95 | + * @brief Return projection name | ||
| 96 | + * | ||
| 97 | + * @return Projection name. | ||
| 98 | + * | ||
| 99 | + * Returns the projection name. | ||
| 100 | + ***************************************************************************/ | ||
| 101 | +inline | ||
| 102 | +std::string GWcsTAN::name(void) const | ||
| 103 | +{ | ||
| 104 | + return "gnomonic"; | ||
| 105 | +} | ||
| 106 | + | ||
| 78 | #endif /* GWCSTAN_HPP */ | 107 | #endif /* GWCSTAN_HPP */ |
src/sky/GWcsAIT.cpp
| @@ -34,7 +34,6 @@ | @@ -34,7 +34,6 @@ | ||
| 34 | #include "GWcsRegistry.hpp" | 34 | #include "GWcsRegistry.hpp" |
| 35 | 35 | ||
| 36 | /* __ Method name definitions ____________________________________________ */ | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_PRJ_SET "GWcsAIT::prj_set()" | ||
| 38 | #define G_PRJ_X2S "GWcsAIT::prj_x2s(int, int, int, int, double*, double*,"\ | 37 | #define G_PRJ_X2S "GWcsAIT::prj_x2s(int, int, int, int, double*, double*,"\ |
| 39 | " double*, double*, int*)" | 38 | " double*, double*, int*)" |
| 40 | #define G_PRJ_S2X "GWcsAIT::prj_s2x(int, int, int, int, double*, double*,"\ | 39 | #define G_PRJ_S2X "GWcsAIT::prj_s2x(int, int, int, int, double*, double*,"\ |
| @@ -325,7 +324,7 @@ void GWcsAIT::prj_set(void) const | @@ -325,7 +324,7 @@ void GWcsAIT::prj_set(void) const | ||
| 325 | 324 | ||
| 326 | 325 | ||
| 327 | /***********************************************************************//** | 326 | /***********************************************************************//** |
| 328 | - * @brief Cartesian-to-spherical deprojection | 327 | + * @brief Pixel-to-spherical deprojection |
| 329 | * | 328 | * |
| 330 | * @param[in] nx X vector length. | 329 | * @param[in] nx X vector length. |
| 331 | * @param[in] ny Y vector length (0=no replication). | 330 | * @param[in] ny Y vector length (0=no replication). |
| @@ -343,13 +342,13 @@ void GWcsAIT::prj_set(void) const | @@ -343,13 +342,13 @@ void GWcsAIT::prj_set(void) const | ||
| 343 | * One or more of the (x,y) coordinates were invalid, as indicated | 342 | * One or more of the (x,y) coordinates were invalid, as indicated |
| 344 | * by the stat vector. | 343 | * by the stat vector. |
| 345 | * | 344 | * |
| 346 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | 345 | + * Deproject pixel (x,y) coordinates in the plane of projection to native |
| 347 | * spherical coordinates (phi,theta). | 346 | * spherical coordinates (phi,theta). |
| 348 | * | 347 | * |
| 349 | * This method has been adapted from the wcslib function prj.c::aitx2s(). | 348 | * This method has been adapted from the wcslib function prj.c::aitx2s(). |
| 350 | * The interface follows very closely that of wcslib. In contrast to the | 349 | * The interface follows very closely that of wcslib. In contrast to the |
| 351 | * wcslib routine, however, the method assumes that the projection has been | 350 | * wcslib routine, however, the method assumes that the projection has been |
| 352 | - * setup previsouly (as this will be done by the constructor). | 351 | + * setup previously (as this will be done by the constructor). |
| 353 | ***************************************************************************/ | 352 | ***************************************************************************/ |
| 354 | void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, | 353 | void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, |
| 355 | const double* x, const double* y, | 354 | const double* x, const double* y, |
| @@ -458,7 +457,7 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -458,7 +457,7 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 458 | 457 | ||
| 459 | 458 | ||
| 460 | /***********************************************************************//** | 459 | /***********************************************************************//** |
| 461 | - * @brief Generic spherical-to-Cartesian projection | 460 | + * @brief Generic spherical-to-pixel projection |
| 462 | * | 461 | * |
| 463 | * @param[in] nphi Longitude vector length. | 462 | * @param[in] nphi Longitude vector length. |
| 464 | * @param[in] ntheta Latitude vector length (0=no replication). | 463 | * @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, | @@ -476,13 +475,13 @@ void GWcsAIT::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 476 | * One or more of the (phi,theta) coordinates were invalid, as | 475 | * One or more of the (phi,theta) coordinates were invalid, as |
| 477 | * indicated by the stat vector. | 476 | * indicated by the stat vector. |
| 478 | * | 477 | * |
| 479 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | 478 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) |
| 480 | * coordinates in the plane of projection. | 479 | * coordinates in the plane of projection. |
| 481 | * | 480 | * |
| 482 | * This method has been adapted from the wcslib function prj.c::aits2x(). | 481 | * This method has been adapted from the wcslib function prj.c::aits2x(). |
| 483 | * The interface follows very closely that of wcslib. In contrast to the | 482 | * The interface follows very closely that of wcslib. In contrast to the |
| 484 | * wcslib routine, however, the method assumes that the projection has been | 483 | * wcslib routine, however, the method assumes that the projection has been |
| 485 | - * setup previsouly (as this will be done by the constructor). | 484 | + * setup previously (as this will be done by the constructor). |
| 486 | ***************************************************************************/ | 485 | ***************************************************************************/ |
| 487 | void GWcsAIT::prj_s2x(int nphi, int ntheta, int spt, int sxy, | 486 | void GWcsAIT::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 488 | const double* phi, const double* theta, | 487 | const double* phi, const double* theta, |
src/sky/GWcsAZP.cpp
| @@ -352,7 +352,7 @@ void GWcsAZP::prj_set(void) const | @@ -352,7 +352,7 @@ void GWcsAZP::prj_set(void) const | ||
| 352 | 352 | ||
| 353 | 353 | ||
| 354 | /***********************************************************************//** | 354 | /***********************************************************************//** |
| 355 | - * @brief Cartesian-to-spherical deprojection | 355 | + * @brief Pixel-to-spherical deprojection |
| 356 | * | 356 | * |
| 357 | * @param[in] nx X vector length. | 357 | * @param[in] nx X vector length. |
| 358 | * @param[in] ny Y vector length (0=no replication). | 358 | * @param[in] ny Y vector length (0=no replication). |
| @@ -370,13 +370,13 @@ void GWcsAZP::prj_set(void) const | @@ -370,13 +370,13 @@ void GWcsAZP::prj_set(void) const | ||
| 370 | * One or more of the (x,y) coordinates were invalid, as indicated | 370 | * One or more of the (x,y) coordinates were invalid, as indicated |
| 371 | * by the stat vector. | 371 | * by the stat vector. |
| 372 | * | 372 | * |
| 373 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | 373 | + * Deproject pixel (x,y) coordinates in the plane of projection to native |
| 374 | * spherical coordinates (phi,theta). | 374 | * spherical coordinates (phi,theta). |
| 375 | * | 375 | * |
| 376 | * This method has been adapted from the wcslib function prj.c::azpx2s(). | 376 | * This method has been adapted from the wcslib function prj.c::azpx2s(). |
| 377 | * The interface follows very closely that of wcslib. In contrast to the | 377 | * The interface follows very closely that of wcslib. In contrast to the |
| 378 | * wcslib routine, however, the method assumes that the projection has been | 378 | * wcslib routine, however, the method assumes that the projection has been |
| 379 | - * setup previsouly (as this will be done by the constructor). | 379 | + * setup previously (as this will be done by the constructor). |
| 380 | ***************************************************************************/ | 380 | ***************************************************************************/ |
| 381 | void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, | 381 | void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, |
| 382 | const double* x, const double* y, | 382 | const double* x, const double* y, |
| @@ -477,7 +477,7 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -477,7 +477,7 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 477 | 477 | ||
| 478 | 478 | ||
| 479 | /***********************************************************************//** | 479 | /***********************************************************************//** |
| 480 | - * @brief Generic spherical-to-Cartesian projection | 480 | + * @brief Generic spherical-to-pixel projection |
| 481 | * | 481 | * |
| 482 | * @param[in] nphi Longitude vector length. | 482 | * @param[in] nphi Longitude vector length. |
| 483 | * @param[in] ntheta Latitude vector length (0=no replication). | 483 | * @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, | @@ -495,13 +495,13 @@ void GWcsAZP::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 495 | * One or more of the (phi,theta) coordinates were invalid, as | 495 | * One or more of the (phi,theta) coordinates were invalid, as |
| 496 | * indicated by the stat vector. | 496 | * indicated by the stat vector. |
| 497 | * | 497 | * |
| 498 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | 498 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) |
| 499 | * coordinates in the plane of projection. | 499 | * coordinates in the plane of projection. |
| 500 | * | 500 | * |
| 501 | * This method has been adapted from the wcslib function prj.c::azps2x(). | 501 | * This method has been adapted from the wcslib function prj.c::azps2x(). |
| 502 | * The interface follows very closely that of wcslib. In contrast to the | 502 | * The interface follows very closely that of wcslib. In contrast to the |
| 503 | * wcslib routine, however, the method assumes that the projection has been | 503 | * wcslib routine, however, the method assumes that the projection has been |
| 504 | - * setup previsouly (as this will be done by the constructor). | 504 | + * setup previously (as this will be done by the constructor). |
| 505 | ***************************************************************************/ | 505 | ***************************************************************************/ |
| 506 | void GWcsAZP::prj_s2x(int nphi, int ntheta, int spt, int sxy, | 506 | void GWcsAZP::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 507 | const double* phi, const double* theta, | 507 | const double* phi, const double* theta, |
src/sky/GWcsCAR.cpp
| @@ -336,7 +336,7 @@ void GWcsCAR::prj_set(void) const | @@ -336,7 +336,7 @@ void GWcsCAR::prj_set(void) const | ||
| 336 | * This method has been adapted from the wcslib function prj.c::carx2s(). | 336 | * This method has been adapted from the wcslib function prj.c::carx2s(). |
| 337 | * The interface follows very closely that of wcslib. In contrast to the | 337 | * The interface follows very closely that of wcslib. In contrast to the |
| 338 | * wcslib routine, however, the method assumes that the projection has been | 338 | * wcslib routine, however, the method assumes that the projection has been |
| 339 | - * setup previsouly (as this will be done by the constructor). | 339 | + * setup previously (as this will be done by the constructor). |
| 340 | ***************************************************************************/ | 340 | ***************************************************************************/ |
| 341 | void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, | 341 | void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, |
| 342 | const double* x, const double* y, | 342 | const double* x, const double* y, |
| @@ -410,7 +410,7 @@ void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -410,7 +410,7 @@ void GWcsCAR::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 410 | * This method has been adapted from the wcslib function prj.c::cars2x(). | 410 | * This method has been adapted from the wcslib function prj.c::cars2x(). |
| 411 | * The interface follows very closely that of wcslib. In contrast to the | 411 | * The interface follows very closely that of wcslib. In contrast to the |
| 412 | * wcslib routine, however, the method assumes that the projection has been | 412 | * wcslib routine, however, the method assumes that the projection has been |
| 413 | - * setup previsouly (as this will be done by the constructor). | 413 | + * setup previously (as this will be done by the constructor). |
| 414 | ***************************************************************************/ | 414 | ***************************************************************************/ |
| 415 | void GWcsCAR::prj_s2x(int nphi, int ntheta, int spt, int sxy, | 415 | void GWcsCAR::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 416 | const double* phi, const double* theta, | 416 | const double* phi, const double* theta, |
src/sky/GWcsMER.cpp
| @@ -70,7 +70,7 @@ GWcsMER::GWcsMER(void) : GWcs() | @@ -70,7 +70,7 @@ GWcsMER::GWcsMER(void) : GWcs() | ||
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | /***********************************************************************//** | 72 | /***********************************************************************//** |
| 73 | - * @brief Constructor | 73 | + * @brief Projection constructor |
| 74 | * | 74 | * |
| 75 | * @param[in] coords Coordinate system. | 75 | * @param[in] coords Coordinate system. |
| 76 | * @param[in] crval1 X value of reference pixel. | 76 | * @param[in] crval1 X value of reference pixel. |
| @@ -136,8 +136,9 @@ GWcsMER::~GWcsMER(void) | @@ -136,8 +136,9 @@ GWcsMER::~GWcsMER(void) | ||
| 136 | * @brief Assignment operator | 136 | * @brief Assignment operator |
| 137 | * | 137 | * |
| 138 | * @param[in] wcs World Coordinate System. | 138 | * @param[in] wcs World Coordinate System. |
| 139 | + * @return World Coordinate System. | ||
| 139 | ***************************************************************************/ | 140 | ***************************************************************************/ |
| 140 | -GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) | 141 | +GWcsMER& GWcsMER::operator=(const GWcsMER& wcs) |
| 141 | { | 142 | { |
| 142 | // Execute only if object is not identical | 143 | // Execute only if object is not identical |
| 143 | if (this != &wcs) { | 144 | if (this != &wcs) { |
| @@ -168,7 +169,7 @@ GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) | @@ -168,7 +169,7 @@ GWcsMER& GWcsMER::operator= (const GWcsMER& wcs) | ||
| 168 | ==========================================================================*/ | 169 | ==========================================================================*/ |
| 169 | 170 | ||
| 170 | /***********************************************************************//** | 171 | /***********************************************************************//** |
| 171 | - * @brief Clear instance | 172 | + * @brief Clear Mercator's projection |
| 172 | * | 173 | * |
| 173 | * This method properly resets the object to an initial state. | 174 | * This method properly resets the object to an initial state. |
| 174 | ***************************************************************************/ | 175 | ***************************************************************************/ |
| @@ -190,7 +191,9 @@ void GWcsMER::clear(void) | @@ -190,7 +191,9 @@ void GWcsMER::clear(void) | ||
| 190 | 191 | ||
| 191 | 192 | ||
| 192 | /***********************************************************************//** | 193 | /***********************************************************************//** |
| 193 | - * @brief Clone instance | 194 | + * @brief Clone Mercator's projection |
| 195 | + * | ||
| 196 | + * @return Pointer to deep copy of Mercator's projection. | ||
| 194 | ***************************************************************************/ | 197 | ***************************************************************************/ |
| 195 | GWcsMER* GWcsMER::clone(void) const | 198 | GWcsMER* GWcsMER::clone(void) const |
| 196 | { | 199 | { |
| @@ -202,7 +205,7 @@ GWcsMER* GWcsMER::clone(void) const | @@ -202,7 +205,7 @@ GWcsMER* GWcsMER::clone(void) const | ||
| 202 | * @brief Print WCS information | 205 | * @brief Print WCS information |
| 203 | * | 206 | * |
| 204 | * @param[in] chatter Chattiness (defaults to NORMAL). | 207 | * @param[in] chatter Chattiness (defaults to NORMAL). |
| 205 | - * @return String containing WCS information. | 208 | + * @return String containing Mercator's projection information. |
| 206 | ***************************************************************************/ | 209 | ***************************************************************************/ |
| 207 | std::string GWcsMER::print(const GChatter& chatter) const | 210 | std::string GWcsMER::print(const GChatter& chatter) const |
| 208 | { | 211 | { |
| @@ -295,7 +298,8 @@ void GWcsMER::prj_set(void) const | @@ -295,7 +298,8 @@ void GWcsMER::prj_set(void) const | ||
| 295 | m_r0 = gammalib::rad2deg; | 298 | m_r0 = gammalib::rad2deg; |
| 296 | m_w.push_back(1.0); | 299 | m_w.push_back(1.0); |
| 297 | m_w.push_back(1.0); | 300 | m_w.push_back(1.0); |
| 298 | - } else { | 301 | + } |
| 302 | + else { | ||
| 299 | m_w.push_back(m_r0 * gammalib::deg2rad); | 303 | m_w.push_back(m_r0 * gammalib::deg2rad); |
| 300 | m_w.push_back(1.0/m_w[0]); | 304 | m_w.push_back(1.0/m_w[0]); |
| 301 | } | 305 | } |
| @@ -312,7 +316,7 @@ void GWcsMER::prj_set(void) const | @@ -312,7 +316,7 @@ void GWcsMER::prj_set(void) const | ||
| 312 | 316 | ||
| 313 | 317 | ||
| 314 | /***********************************************************************//** | 318 | /***********************************************************************//** |
| 315 | - * @brief Cartesian-to-spherical deprojection | 319 | + * @brief Pixel-to-spherical deprojection |
| 316 | * | 320 | * |
| 317 | * @param[in] nx X vector length. | 321 | * @param[in] nx X vector length. |
| 318 | * @param[in] ny Y vector length (0=no replication). | 322 | * @param[in] ny Y vector length (0=no replication). |
| @@ -326,13 +330,13 @@ void GWcsMER::prj_set(void) const | @@ -326,13 +330,13 @@ void GWcsMER::prj_set(void) const | ||
| 326 | * coordinates [deg]. | 330 | * coordinates [deg]. |
| 327 | * @param[out] stat Status return value for each vector element (always 0) | 331 | * @param[out] stat Status return value for each vector element (always 0) |
| 328 | * | 332 | * |
| 329 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | 333 | + * Deproject pixel (x,y) coordinates in the plane of projection to native |
| 330 | * spherical coordinates (phi,theta). | 334 | * spherical coordinates (phi,theta). |
| 331 | * | 335 | * |
| 332 | * This method has been adapted from the wcslib function prj.c::merx2s(). | 336 | * This method has been adapted from the wcslib function prj.c::merx2s(). |
| 333 | * The interface follows very closely that of wcslib. In contrast to the | 337 | * The interface follows very closely that of wcslib. In contrast to the |
| 334 | * wcslib routine, however, the method assumes that the projection has been | 338 | * wcslib routine, however, the method assumes that the projection has been |
| 335 | - * setup previsouly (as this will be done by the constructor). | 339 | + * setup previously (as this will be done by the constructor). |
| 336 | ***************************************************************************/ | 340 | ***************************************************************************/ |
| 337 | void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, | 341 | void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, |
| 338 | const double* x, const double* y, | 342 | const double* x, const double* y, |
| @@ -386,7 +390,7 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -386,7 +390,7 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 386 | 390 | ||
| 387 | 391 | ||
| 388 | /***********************************************************************//** | 392 | /***********************************************************************//** |
| 389 | - * @brief Generic spherical-to-Cartesian projection | 393 | + * @brief Generic spherical-to-pixel projection |
| 390 | * | 394 | * |
| 391 | * @param[in] nphi Longitude vector length. | 395 | * @param[in] nphi Longitude vector length. |
| 392 | * @param[in] ntheta Latitude vector length (0=no replication). | 396 | * @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, | @@ -400,15 +404,14 @@ void GWcsMER::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 400 | * @param[out] y Vector of projected y coordinates. | 404 | * @param[out] y Vector of projected y coordinates. |
| 401 | * @param[out] stat Status return value for each vector element (always 0) | 405 | * @param[out] stat Status return value for each vector element (always 0) |
| 402 | * | 406 | * |
| 403 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | 407 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) |
| 404 | * coordinates in the plane of projection. | 408 | * coordinates in the plane of projection. |
| 405 | * | 409 | * |
| 406 | * This method has been adapted from the wcslib function prj.c::mers2x(). | 410 | * This method has been adapted from the wcslib function prj.c::mers2x(). |
| 407 | * The interface follows very closely that of wcslib. In contrast to the | 411 | * The interface follows very closely that of wcslib. In contrast to the |
| 408 | * wcslib routine, however, the method assumes that the projection has been | 412 | * wcslib routine, however, the method assumes that the projection has been |
| 409 | - * setup previsouly (as this will be done by the constructor). | 413 | + * setup previously (as this will be done by the constructor). |
| 410 | ***************************************************************************/ | 414 | ***************************************************************************/ |
| 411 | -#define G_PRJ_X2S | ||
| 412 | void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, | 415 | void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 413 | const double* phi, const double* theta, | 416 | const double* phi, const double* theta, |
| 414 | double* x, double* y, int* stat) const | 417 | double* x, double* y, int* stat) const |
| @@ -472,10 +475,3 @@ void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, | @@ -472,10 +475,3 @@ void GWcsMER::prj_s2x(int nphi, int ntheta, int spt, int sxy, | ||
| 472 | // Return | 475 | // Return |
| 473 | return; | 476 | return; |
| 474 | } | 477 | } |
| 475 | - | ||
| 476 | - | ||
| 477 | -/*========================================================================== | ||
| 478 | - = = | ||
| 479 | - = Friends = | ||
| 480 | - = = | ||
| 481 | - ==========================================================================*/ |
src/sky/GWcsSTG.cpp
| @@ -34,8 +34,8 @@ | @@ -34,8 +34,8 @@ | ||
| 34 | #include "GWcsRegistry.hpp" | 34 | #include "GWcsRegistry.hpp" |
| 35 | 35 | ||
| 36 | /* __ Method name definitions ____________________________________________ */ | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_PRJ_S2X "GWcsSTG::prj_s2x(int,int,int,int,double*,double*,double*,"\ | ||
| 38 | - "double*,int*)" | 37 | +#define G_PRJ_S2X "GWcsSTG::prj_s2x(int, int, int, int, double*, double*,"\ |
| 38 | + " double*, double*, int*)" | ||
| 39 | 39 | ||
| 40 | /* __ Macros _____________________________________________________________ */ | 40 | /* __ Macros _____________________________________________________________ */ |
| 41 | 41 | ||
| @@ -72,7 +72,7 @@ GWcsSTG::GWcsSTG(void) : GWcs() | @@ -72,7 +72,7 @@ GWcsSTG::GWcsSTG(void) : GWcs() | ||
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | /***********************************************************************//** | 74 | /***********************************************************************//** |
| 75 | - * @brief Constructor | 75 | + * @brief Projection constructor |
| 76 | * | 76 | * |
| 77 | * @param[in] coords Coordinate system. | 77 | * @param[in] coords Coordinate system. |
| 78 | * @param[in] crval1 X value of reference pixel. | 78 | * @param[in] crval1 X value of reference pixel. |
| @@ -138,8 +138,9 @@ GWcsSTG::~GWcsSTG(void) | @@ -138,8 +138,9 @@ GWcsSTG::~GWcsSTG(void) | ||
| 138 | * @brief Assignment operator | 138 | * @brief Assignment operator |
| 139 | * | 139 | * |
| 140 | * @param[in] wcs World Coordinate System. | 140 | * @param[in] wcs World Coordinate System. |
| 141 | + * @return World Coordinate System. | ||
| 141 | ***************************************************************************/ | 142 | ***************************************************************************/ |
| 142 | -GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) | 143 | +GWcsSTG& GWcsSTG::operator=(const GWcsSTG& wcs) |
| 143 | { | 144 | { |
| 144 | // Execute only if object is not identical | 145 | // Execute only if object is not identical |
| 145 | if (this != &wcs) { | 146 | if (this != &wcs) { |
| @@ -170,7 +171,7 @@ GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) | @@ -170,7 +171,7 @@ GWcsSTG& GWcsSTG::operator= (const GWcsSTG& wcs) | ||
| 170 | ==========================================================================*/ | 171 | ==========================================================================*/ |
| 171 | 172 | ||
| 172 | /***********************************************************************//** | 173 | /***********************************************************************//** |
| 173 | - * @brief Clear instance | 174 | + * @brief Clear projection |
| 174 | * | 175 | * |
| 175 | * This method properly resets the object to an initial state. | 176 | * This method properly resets the object to an initial state. |
| 176 | ***************************************************************************/ | 177 | ***************************************************************************/ |
| @@ -192,7 +193,9 @@ void GWcsSTG::clear(void) | @@ -192,7 +193,9 @@ void GWcsSTG::clear(void) | ||
| 192 | 193 | ||
| 193 | 194 | ||
| 194 | /***********************************************************************//** | 195 | /***********************************************************************//** |
| 195 | - * @brief Clone instance | 196 | + * @brief Clone projection |
| 197 | + * | ||
| 198 | + * @return Pointer to deep copy of projection. | ||
| 196 | ***************************************************************************/ | 199 | ***************************************************************************/ |
| 197 | GWcsSTG* GWcsSTG::clone(void) const | 200 | GWcsSTG* GWcsSTG::clone(void) const |
| 198 | { | 201 | { |
| @@ -201,10 +204,10 @@ GWcsSTG* GWcsSTG::clone(void) const | @@ -201,10 +204,10 @@ GWcsSTG* GWcsSTG::clone(void) const | ||
| 201 | 204 | ||
| 202 | 205 | ||
| 203 | /***********************************************************************//** | 206 | /***********************************************************************//** |
| 204 | - * @brief Print WCS information | 207 | + * @brief Print projection information |
| 205 | * | 208 | * |
| 206 | * @param[in] chatter Chattiness (defaults to NORMAL). | 209 | * @param[in] chatter Chattiness (defaults to NORMAL). |
| 207 | - * @return String containing WCS information. | 210 | + * @return String containing projection information. |
| 208 | ***************************************************************************/ | 211 | ***************************************************************************/ |
| 209 | std::string GWcsSTG::print(const GChatter& chatter) const | 212 | std::string GWcsSTG::print(const GChatter& chatter) const |
| 210 | { | 213 | { |
| @@ -274,7 +277,7 @@ void GWcsSTG::free_members(void) | @@ -274,7 +277,7 @@ void GWcsSTG::free_members(void) | ||
| 274 | * @brief Setup of projection | 277 | * @brief Setup of projection |
| 275 | * | 278 | * |
| 276 | * This method sets up the projection information. The method has been | 279 | * This method sets up the projection information. The method has been |
| 277 | - * adapted from the wcslib function prj.c::carset. | 280 | + * adapted from the wcslib function prj.c::stgset. |
| 278 | * | 281 | * |
| 279 | * Given and/or returned: | 282 | * Given and/or returned: |
| 280 | * m_r0 Reset to 180/pi if 0. | 283 | * m_r0 Reset to 180/pi if 0. |
| @@ -311,7 +314,7 @@ void GWcsSTG::prj_set(void) const | @@ -311,7 +314,7 @@ void GWcsSTG::prj_set(void) const | ||
| 311 | 314 | ||
| 312 | 315 | ||
| 313 | /***********************************************************************//** | 316 | /***********************************************************************//** |
| 314 | - * @brief Cartesian-to-spherical deprojection | 317 | + * @brief Pixel-to-spherical deprojection |
| 315 | * | 318 | * |
| 316 | * @param[in] nx X vector length. | 319 | * @param[in] nx X vector length. |
| 317 | * @param[in] ny Y vector length (0=no replication). | 320 | * @param[in] ny Y vector length (0=no replication). |
| @@ -325,21 +328,22 @@ void GWcsSTG::prj_set(void) const | @@ -325,21 +328,22 @@ void GWcsSTG::prj_set(void) const | ||
| 325 | * coordinates [deg]. | 328 | * coordinates [deg]. |
| 326 | * @param[out] stat Status return value for each vector element (always 0) | 329 | * @param[out] stat Status return value for each vector element (always 0) |
| 327 | * | 330 | * |
| 328 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | 331 | + * Deproject pixel (x,y) coordinates in the plane of projection to native |
| 329 | * spherical coordinates (phi,theta). | 332 | * spherical coordinates (phi,theta). |
| 330 | * | 333 | * |
| 331 | - * This method has been adapted from the wcslib function prj.c::carx2s(). | 334 | + * This method has been adapted from the wcslib function prj.c::stgx2s(). |
| 332 | * The interface follows very closely that of wcslib. In contrast to the | 335 | * The interface follows very closely that of wcslib. In contrast to the |
| 333 | * wcslib routine, however, the method assumes that the projection has been | 336 | * wcslib routine, however, the method assumes that the projection has been |
| 334 | - * setup previsouly (as this will be done by the constructor). | 337 | + * setup previously (as this will be done by the constructor). |
| 335 | ***************************************************************************/ | 338 | ***************************************************************************/ |
| 336 | void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, | 339 | void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, |
| 337 | const double* x, const double* y, | 340 | const double* x, const double* y, |
| 338 | double* phi, double* theta, int* stat) const | 341 | double* phi, double* theta, int* stat) const |
| 339 | { | 342 | { |
| 340 | // Initialize projection if required | 343 | // Initialize projection if required |
| 341 | - if (!m_prjset) | 344 | + if (!m_prjset) { |
| 342 | prj_set(); | 345 | prj_set(); |
| 346 | + } | ||
| 343 | 347 | ||
| 344 | // Set value replication length mx,my | 348 | // Set value replication length mx,my |
| 345 | int mx; | 349 | int mx; |
| @@ -394,7 +398,7 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -394,7 +398,7 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 394 | 398 | ||
| 395 | 399 | ||
| 396 | /***********************************************************************//** | 400 | /***********************************************************************//** |
| 397 | - * @brief Generic spherical-to-Cartesian projection | 401 | + * @brief Generic spherical-to-pixel projection |
| 398 | * | 402 | * |
| 399 | * @param[in] nphi Longitude vector length. | 403 | * @param[in] nphi Longitude vector length. |
| 400 | * @param[in] ntheta Latitude vector length (0=no replication). | 404 | * @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, | @@ -408,21 +412,22 @@ void GWcsSTG::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 408 | * @param[out] y Vector of projected y coordinates. | 412 | * @param[out] y Vector of projected y coordinates. |
| 409 | * @param[out] stat Status return value for each vector element (always 0) | 413 | * @param[out] stat Status return value for each vector element (always 0) |
| 410 | * | 414 | * |
| 411 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | 415 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) |
| 412 | * coordinates in the plane of projection. | 416 | * coordinates in the plane of projection. |
| 413 | * | 417 | * |
| 414 | - * This method has been adapted from the wcslib function prj.c::cars2x(). | 418 | + * This method has been adapted from the wcslib function prj.c::stgs2x(). |
| 415 | * The interface follows very closely that of wcslib. In contrast to the | 419 | * The interface follows very closely that of wcslib. In contrast to the |
| 416 | * wcslib routine, however, the method assumes that the projection has been | 420 | * wcslib routine, however, the method assumes that the projection has been |
| 417 | - * setup previsouly (as this will be done by the constructor). | 421 | + * setup previously (as this will be done by the constructor). |
| 418 | ***************************************************************************/ | 422 | ***************************************************************************/ |
| 419 | void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, | 423 | void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 420 | const double* phi, const double* theta, | 424 | const double* phi, const double* theta, |
| 421 | double* x, double* y, int* stat) const | 425 | double* x, double* y, int* stat) const |
| 422 | { | 426 | { |
| 423 | // Initialize projection if required | 427 | // Initialize projection if required |
| 424 | - if (!m_prjset) | 428 | + if (!m_prjset) { |
| 425 | prj_set(); | 429 | prj_set(); |
| 430 | + } | ||
| 426 | 431 | ||
| 427 | // Set value replication length mphi,mtheta | 432 | // Set value replication length mphi,mtheta |
| 428 | int mphi; | 433 | int mphi; |
| @@ -501,10 +506,3 @@ void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, | @@ -501,10 +506,3 @@ void GWcsSTG::prj_s2x(int nphi, int ntheta, int spt, int sxy, | ||
| 501 | // Return | 506 | // Return |
| 502 | return; | 507 | return; |
| 503 | } | 508 | } |
| 504 | - | ||
| 505 | - | ||
| 506 | -/*========================================================================== | ||
| 507 | - = = | ||
| 508 | - = Friends = | ||
| 509 | - = = | ||
| 510 | - ==========================================================================*/ |
src/sky/GWcsTAN.cpp
| @@ -34,8 +34,8 @@ | @@ -34,8 +34,8 @@ | ||
| 34 | #include "GWcsRegistry.hpp" | 34 | #include "GWcsRegistry.hpp" |
| 35 | 35 | ||
| 36 | /* __ Method name definitions ____________________________________________ */ | 36 | /* __ Method name definitions ____________________________________________ */ |
| 37 | -#define G_PRJ_S2X "GWcsTAN::prj_s2x(int,int,int,int,double*,double*,double*,"\ | ||
| 38 | - "double*,int*)" | 37 | +#define G_PRJ_S2X "GWcsTAN::prj_s2x(int, int, int, int, double*, double*,"\ |
| 38 | + " double*, double*, int*)" | ||
| 39 | 39 | ||
| 40 | /* __ Macros _____________________________________________________________ */ | 40 | /* __ Macros _____________________________________________________________ */ |
| 41 | 41 | ||
| @@ -72,7 +72,7 @@ GWcsTAN::GWcsTAN(void) : GWcs() | @@ -72,7 +72,7 @@ GWcsTAN::GWcsTAN(void) : GWcs() | ||
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | /***********************************************************************//** | 74 | /***********************************************************************//** |
| 75 | - * @brief Constructor | 75 | + * @brief Projection constructor |
| 76 | * | 76 | * |
| 77 | * @param[in] coords Coordinate system. | 77 | * @param[in] coords Coordinate system. |
| 78 | * @param[in] crval1 X value of reference pixel. | 78 | * @param[in] crval1 X value of reference pixel. |
| @@ -138,8 +138,9 @@ GWcsTAN::~GWcsTAN(void) | @@ -138,8 +138,9 @@ GWcsTAN::~GWcsTAN(void) | ||
| 138 | * @brief Assignment operator | 138 | * @brief Assignment operator |
| 139 | * | 139 | * |
| 140 | * @param[in] wcs World Coordinate System. | 140 | * @param[in] wcs World Coordinate System. |
| 141 | + * @return World Coordinate System. | ||
| 141 | ***************************************************************************/ | 142 | ***************************************************************************/ |
| 142 | -GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) | 143 | +GWcsTAN& GWcsTAN::operator=(const GWcsTAN& wcs) |
| 143 | { | 144 | { |
| 144 | // Execute only if object is not identical | 145 | // Execute only if object is not identical |
| 145 | if (this != &wcs) { | 146 | if (this != &wcs) { |
| @@ -170,9 +171,9 @@ GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) | @@ -170,9 +171,9 @@ GWcsTAN& GWcsTAN::operator= (const GWcsTAN& wcs) | ||
| 170 | ==========================================================================*/ | 171 | ==========================================================================*/ |
| 171 | 172 | ||
| 172 | /***********************************************************************//** | 173 | /***********************************************************************//** |
| 173 | - * @brief Clear instance | 174 | + * @brief Clear gnomonic projection |
| 174 | * | 175 | * |
| 175 | - * This method properly resets the object to an initial state. | 176 | + * Resets the gnomonic projection to an clean initial state. |
| 176 | ***************************************************************************/ | 177 | ***************************************************************************/ |
| 177 | void GWcsTAN::clear(void) | 178 | void GWcsTAN::clear(void) |
| 178 | { | 179 | { |
| @@ -192,7 +193,9 @@ void GWcsTAN::clear(void) | @@ -192,7 +193,9 @@ void GWcsTAN::clear(void) | ||
| 192 | 193 | ||
| 193 | 194 | ||
| 194 | /***********************************************************************//** | 195 | /***********************************************************************//** |
| 195 | - * @brief Clone instance | 196 | + * @brief Clone gnomonic projection |
| 197 | + * | ||
| 198 | + * @return Pointer to deep copy of gnomonic projection. | ||
| 196 | ***************************************************************************/ | 199 | ***************************************************************************/ |
| 197 | GWcsTAN* GWcsTAN::clone(void) const | 200 | GWcsTAN* GWcsTAN::clone(void) const |
| 198 | { | 201 | { |
| @@ -201,10 +204,10 @@ GWcsTAN* GWcsTAN::clone(void) const | @@ -201,10 +204,10 @@ GWcsTAN* GWcsTAN::clone(void) const | ||
| 201 | 204 | ||
| 202 | 205 | ||
| 203 | /***********************************************************************//** | 206 | /***********************************************************************//** |
| 204 | - * @brief Print WCS information | 207 | + * @brief Print gnomonic projection information |
| 205 | * | 208 | * |
| 206 | * @param[in] chatter Chattiness (defaults to NORMAL). | 209 | * @param[in] chatter Chattiness (defaults to NORMAL). |
| 207 | - * @return String containing WCS information. | 210 | + * @return String containing gnomonic projection information. |
| 208 | ***************************************************************************/ | 211 | ***************************************************************************/ |
| 209 | std::string GWcsTAN::print(const GChatter& chatter) const | 212 | std::string GWcsTAN::print(const GChatter& chatter) const |
| 210 | { | 213 | { |
| @@ -274,7 +277,7 @@ void GWcsTAN::free_members(void) | @@ -274,7 +277,7 @@ void GWcsTAN::free_members(void) | ||
| 274 | * @brief Setup of projection | 277 | * @brief Setup of projection |
| 275 | * | 278 | * |
| 276 | * This method sets up the projection information. The method has been | 279 | * This method sets up the projection information. The method has been |
| 277 | - * adapted from the wcslib function prj.c::carset. | 280 | + * adapted from the wcslib function prj.c::tanset. |
| 278 | * | 281 | * |
| 279 | * Given and/or returned: | 282 | * Given and/or returned: |
| 280 | * m_r0 Reset to 180/pi if 0. | 283 | * m_r0 Reset to 180/pi if 0. |
| @@ -291,8 +294,9 @@ void GWcsTAN::prj_set(void) const | @@ -291,8 +294,9 @@ void GWcsTAN::prj_set(void) const | ||
| 291 | m_w.clear(); | 294 | m_w.clear(); |
| 292 | 295 | ||
| 293 | // Precompute | 296 | // Precompute |
| 294 | - if (m_r0 == 0.0) | 297 | + if (m_r0 == 0.0) { |
| 295 | m_r0 = gammalib::rad2deg; | 298 | m_r0 = gammalib::rad2deg; |
| 299 | + } | ||
| 296 | 300 | ||
| 297 | // Compute fiducial offset | 301 | // Compute fiducial offset |
| 298 | prj_off(0.0, 90.0); | 302 | prj_off(0.0, 90.0); |
| @@ -306,7 +310,7 @@ void GWcsTAN::prj_set(void) const | @@ -306,7 +310,7 @@ void GWcsTAN::prj_set(void) const | ||
| 306 | 310 | ||
| 307 | 311 | ||
| 308 | /***********************************************************************//** | 312 | /***********************************************************************//** |
| 309 | - * @brief Cartesian-to-spherical deprojection | 313 | + * @brief Pixel-to-spherical deprojection |
| 310 | * | 314 | * |
| 311 | * @param[in] nx X vector length. | 315 | * @param[in] nx X vector length. |
| 312 | * @param[in] ny Y vector length (0=no replication). | 316 | * @param[in] ny Y vector length (0=no replication). |
| @@ -320,21 +324,22 @@ void GWcsTAN::prj_set(void) const | @@ -320,21 +324,22 @@ void GWcsTAN::prj_set(void) const | ||
| 320 | * coordinates [deg]. | 324 | * coordinates [deg]. |
| 321 | * @param[out] stat Status return value for each vector element (always 0) | 325 | * @param[out] stat Status return value for each vector element (always 0) |
| 322 | * | 326 | * |
| 323 | - * Deproject Cartesian (x,y) coordinates in the plane of projection to native | 327 | + * Deproject pixel (x,y) coordinates in the plane of projection to native |
| 324 | * spherical coordinates (phi,theta). | 328 | * spherical coordinates (phi,theta). |
| 325 | * | 329 | * |
| 326 | - * This method has been adapted from the wcslib function prj.c::carx2s(). | 330 | + * This method has been adapted from the wcslib function prj.c::tanx2s(). |
| 327 | * The interface follows very closely that of wcslib. In contrast to the | 331 | * The interface follows very closely that of wcslib. In contrast to the |
| 328 | * wcslib routine, however, the method assumes that the projection has been | 332 | * wcslib routine, however, the method assumes that the projection has been |
| 329 | - * setup previsouly (as this will be done by the constructor). | 333 | + * setup previously (as this will be done by the constructor). |
| 330 | ***************************************************************************/ | 334 | ***************************************************************************/ |
| 331 | void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | 335 | void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, |
| 332 | const double* x, const double* y, | 336 | const double* x, const double* y, |
| 333 | double* phi, double* theta, int* stat) const | 337 | double* phi, double* theta, int* stat) const |
| 334 | { | 338 | { |
| 335 | // Initialize projection if required | 339 | // Initialize projection if required |
| 336 | - if (!m_prjset) | 340 | + if (!m_prjset) { |
| 337 | prj_set(); | 341 | prj_set(); |
| 342 | + } | ||
| 338 | 343 | ||
| 339 | // Set value replication length mx,my | 344 | // Set value replication length mx,my |
| 340 | int mx; | 345 | int mx; |
| @@ -356,8 +361,9 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -356,8 +361,9 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 356 | for (int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) { | 361 | for (int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) { |
| 357 | double xj = *xp + m_x0; | 362 | double xj = *xp + m_x0; |
| 358 | double* phip = phi + rowoff; | 363 | double* phip = phi + rowoff; |
| 359 | - for (int iy = 0; iy < my; ++iy, phip += rowlen) | 364 | + for (int iy = 0; iy < my; ++iy, phip += rowlen) { |
| 360 | *phip = xj; | 365 | *phip = xj; |
| 366 | + } | ||
| 361 | } | 367 | } |
| 362 | 368 | ||
| 363 | // Do y dependence | 369 | // Do y dependence |
| @@ -371,10 +377,12 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -371,10 +377,12 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 371 | for (int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt) { | 377 | for (int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt) { |
| 372 | double xj = *phip; | 378 | double xj = *phip; |
| 373 | double r = std::sqrt(xj*xj + yj2); | 379 | double r = std::sqrt(xj*xj + yj2); |
| 374 | - if (r == 0.0) | 380 | + if (r == 0.0) { |
| 375 | *phip = 0.0; | 381 | *phip = 0.0; |
| 376 | - else | 382 | + } |
| 383 | + else { | ||
| 377 | *phip = gammalib::atan2d(xj, -yj); | 384 | *phip = gammalib::atan2d(xj, -yj); |
| 385 | + } | ||
| 378 | *thetap = gammalib::atan2d(m_r0, r); | 386 | *thetap = gammalib::atan2d(m_r0, r); |
| 379 | *(statp++) = 0; | 387 | *(statp++) = 0; |
| 380 | } | 388 | } |
| @@ -386,7 +394,7 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | @@ -386,7 +394,7 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 386 | 394 | ||
| 387 | 395 | ||
| 388 | /***********************************************************************//** | 396 | /***********************************************************************//** |
| 389 | - * @brief Generic spherical-to-Cartesian projection | 397 | + * @brief Generic spherical-to-pixel projection |
| 390 | * | 398 | * |
| 391 | * @param[in] nphi Longitude vector length. | 399 | * @param[in] nphi Longitude vector length. |
| 392 | * @param[in] ntheta Latitude vector length (0=no replication). | 400 | * @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, | @@ -400,21 +408,22 @@ void GWcsTAN::prj_x2s(int nx, int ny, int sxy, int spt, | ||
| 400 | * @param[out] y Vector of projected y coordinates. | 408 | * @param[out] y Vector of projected y coordinates. |
| 401 | * @param[out] stat Status return value for each vector element (always 0) | 409 | * @param[out] stat Status return value for each vector element (always 0) |
| 402 | * | 410 | * |
| 403 | - * Project native spherical coordinates (phi,theta) to Cartesian (x,y) | 411 | + * Project native spherical coordinates (phi,theta) to pixel (x,y) |
| 404 | * coordinates in the plane of projection. | 412 | * coordinates in the plane of projection. |
| 405 | * | 413 | * |
| 406 | - * This method has been adapted from the wcslib function prj.c::cars2x(). | 414 | + * This method has been adapted from the wcslib function prj.c::tans2x(). |
| 407 | * The interface follows very closely that of wcslib. In contrast to the | 415 | * The interface follows very closely that of wcslib. In contrast to the |
| 408 | * wcslib routine, however, the method assumes that the projection has been | 416 | * wcslib routine, however, the method assumes that the projection has been |
| 409 | - * setup previsouly (as this will be done by the constructor). | 417 | + * setup previously (as this will be done by the constructor). |
| 410 | ***************************************************************************/ | 418 | ***************************************************************************/ |
| 411 | void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, | 419 | void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, |
| 412 | const double* phi, const double* theta, | 420 | const double* phi, const double* theta, |
| 413 | double* x, double* y, int* stat) const | 421 | double* x, double* y, int* stat) const |
| 414 | { | 422 | { |
| 415 | // Initialize projection if required | 423 | // Initialize projection if required |
| 416 | - if (!m_prjset) | 424 | + if (!m_prjset) { |
| 417 | prj_set(); | 425 | prj_set(); |
| 426 | + } | ||
| 418 | 427 | ||
| 419 | // Set value replication length mphi,mtheta | 428 | // Set value replication length mphi,mtheta |
| 420 | int mphi; | 429 | int mphi; |
| @@ -492,16 +501,10 @@ void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, | @@ -492,16 +501,10 @@ void GWcsTAN::prj_s2x(int nphi, int ntheta, int spt, int sxy, | ||
| 492 | } | 501 | } |
| 493 | 502 | ||
| 494 | // Handle status code | 503 | // Handle status code |
| 495 | - if (status == 4) | 504 | + if (status == 4) { |
| 496 | throw GException::wcs_invalid_phi_theta(G_PRJ_S2X, n_invalid); | 505 | throw GException::wcs_invalid_phi_theta(G_PRJ_S2X, n_invalid); |
| 506 | + } | ||
| 497 | 507 | ||
| 498 | // Return | 508 | // Return |
| 499 | return; | 509 | return; |
| 500 | } | 510 | } |
| 501 | - | ||
| 502 | - | ||
| 503 | -/*========================================================================== | ||
| 504 | - = = | ||
| 505 | - = Friends = | ||
| 506 | - = = | ||
| 507 | - ==========================================================================*/ |