38 #define G_PRJ_X2S "GWcsMOL::prj_x2s(int, int, int, int, double*, double*,"\
39 " double*, double*, int*)"
40 #define G_PRJ_S2X "GWcsMOL::prj_s2x(int, int, int, int, double*, double*,"\
41 " double*, double*, int*)"
44 #define copysign(X, Y) ((Y) < 0.0 ? -fabs(X) : fabs(X))
91 const double& crval1,
const double& crval2,
92 const double& crpix1,
const double& crpix2,
93 const double& cdelt1,
const double& cdelt2) :
94 GWcs(coords, crval1, crval2, crpix1, crpix2, cdelt1, cdelt2)
230 result.append(
"=== GWcsMOL ===");
354 const double* x,
const double* y,
355 double* phi,
double* theta,
int* stat)
const
358 const double tol = 1.0e-12;
383 const double* xp = x;
385 int rowlen = nx * spt;
386 for (
int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) {
387 double xj = *xp +
m_x0;
388 double s =
m_w[3] * xj;
390 double* phip = phi + rowoff;
391 double* thetap = theta + rowoff;
392 for (
int iy = 0; iy < my; ++iy, phip += rowlen, thetap += rowlen) {
399 const double* yp = y;
401 double* thetap = theta;
403 for (
int iy = 0; iy < ny; ++iy, yp += sxy) {
409 double yj = *yp +
m_y0;
410 double y0 = yj /
m_r0;
411 double r = 2.0 - y0 * y0;
420 #if defined(G_DEBUG_PRJ)
421 std::cout <<
"prj_x2s(Phi)..:";
422 std::cout <<
" nx=" << nx;
423 std::cout <<
" ny=" << ny;
424 std::cout <<
" iy=" << iy;
425 std::cout <<
" yp=" << *yp;
426 std::cout <<
" yj=" << yj;
427 std::cout <<
" y0=" << y0;
428 std::cout <<
" phip=" << *phip;
429 std::cout <<
" r=" << r;
430 std::cout <<
" s=" << s;
431 std::cout << std::endl;
446 double z = yj *
m_w[2];
452 #if defined(G_DEBUG_PRJ)
453 std::cout <<
"prj_x2s(Phi)..:";
454 std::cout <<
" nx=" << nx;
455 std::cout <<
" ny=" << ny;
456 std::cout <<
" iy=" << iy;
457 std::cout <<
" yp=" << *yp;
458 std::cout <<
" yj=" << yj;
459 std::cout <<
" y0=" << y0;
460 std::cout <<
" phip=" << *phip;
461 std::cout <<
" r=" << r;
462 std::cout <<
" s=" << s;
463 std::cout <<
" z=" << z;
464 std::cout << std::endl;
480 #if defined(G_DEBUG_PRJ)
481 std::cout <<
"prj_x2s(Phi)..:";
482 std::cout <<
" nx=" << nx;
483 std::cout <<
" ny=" << ny;
484 std::cout <<
" iy=" << iy;
485 std::cout <<
" yp=" << *yp;
486 std::cout <<
" yj=" << yj;
487 std::cout <<
" y0=" << y0;
488 std::cout <<
" phip=" << *phip;
489 std::cout <<
" r=" << r;
490 std::cout <<
" s=" << s;
491 std::cout <<
" z=" << z;
492 std::cout << std::endl;
503 for (
int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt, statp += spt) {
506 if (istat < 0 && *thetap >= 0.0) {
527 status =
prj_bchk(1.0e-11, nx, my, spt, phi, theta, stat);
562 const double* phi,
const double* theta,
563 double* x,
double* y,
int* stat)
const
566 const double tol = 1.0e-13;
591 const double* phip = phi;
593 int rowlen = nphi * sxy;
594 for (
int iphi = 0; iphi < nphi; ++iphi, rowoff += sxy, phip += spt) {
595 double xi =
m_w[1] * (*phip);
596 double* xp = x + rowoff;
597 for (
int itheta = 0; itheta < mtheta; ++itheta) {
604 const double* thetap = theta;
608 for (
int itheta = 0; itheta < ntheta; ++itheta, thetap += spt) {
617 else if (*thetap == 0.0) {
626 for (
int k = 0; k < 100; ++k) {
627 double resid = (v - u) + std::sin(v);
642 double gamma = 0.5 * v;
649 for (
int iphi = 0; iphi < mphi; ++iphi, xp += sxy, yp += sxy, statp += sxy) {
650 *xp = xi * (*xp) -
m_x0;
Mollweide's projection class definition.
void init_members(void)
Initialise class members.
Interface definition for the WCS registry class.
void prj_x2s(int nx, int ny, int sxy, int spt, const double *x, const double *y, double *phi, double *theta, int *stat) const
Pixel-to-spherical deprojection.
virtual GWcsMOL * clone(void) const
Clone instance.
void prj_off(const double &phi0, const double &theta0) const
Compute fiducial offset to force (x,y) = (0,0) at (phi0,theta0)
GVector abs(const GVector &vector)
Computes absolute of vector elements.
void copy_members(const GWcsMOL &wcs)
Copy class members.
Mollweide's projection class definition.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
void init_members(void)
Initialise class members.
virtual void clear(void)
Clear instance.
void free_members(void)
Delete class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print WCS information.
World Coordinate Projection registry class interface definition.
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
void wcs_set(void) const
Setup of World Coordinate System.
virtual GWcs & operator=(const GWcs &wcs)
Assignment operator.
double m_x0
Fiducial x offset.
GWcsMOL & operator=(const GWcsMOL &wcs)
Assignment operator.
std::string wcs_print(const GChatter &chatter=NORMAL) const
Print WCS information.
void prj_set(void) const
Setup of projection.
GVector asin(const GVector &vector)
Computes arcsin of vector elements.
void free_members(void)
Delete class members.
std::vector< double > m_w
Intermediate values.
void free_members(void)
Delete class members.
Abstract world coordinate system base class.
int prj_bchk(const double &tol, const int &nphi, const int &ntheta, const int &spt, double *phi, double *theta, int *stat) const
Performs bounds checking on native spherical coordinates.
double m_y0
Fiducial y offset.
void check_prj_s2x_status(const std::string &origin, const int &status, const int &number)
Checks status of GWcs::prj_s2x method.
const GWcsMOL g_wcs_mol_seed
GVector sin(const GVector &vector)
Computes sine of vector elements.
void check_prj_x2s_status(const std::string &origin, const int &status, const int &number)
Checks status of GWcs::prj_x2s method.
Exception handler interface definition.
bool m_prjset
Projection is set.
void init_members(void)
Initialise class members.
GWcsMOL(void)
Void constructor.
void prj_s2x(int nphi, int ntheta, int spt, int sxy, const double *phi, const double *theta, double *x, double *y, int *stat) const
Generic spherical-to-pixel projection.
virtual ~GWcsMOL(void)
Destructor.
double m_r0
Radius of the generating sphere.
Mathematical function definitions.