37#define G_PRJ_SET "GWcsAZP::prj_set()"
38#define G_PRJ_X2S "GWcsAZP::prj_x2s(int, int, int, int, double*, double*,"\
39 " double*, double*, int*)"
40#define G_PRJ_S2X "GWcsAZP::prj_s2x(int, int, int, int, double*, double*,"\
41 " double*, double*, int*)"
89 const double& crval1,
const double& crval2,
90 const double& crpix1,
const double& crpix2,
91 const double& cdelt1,
const double& cdelt2) :
92 GWcs(coords, crval1, crval2, crpix1, crpix2, cdelt1, cdelt2)
228 result.append(
"=== GWcsAZP ===");
325 std::string msg =
"PV(1)=-1 encountered.";
330 std::string msg =
"cos(PV(2))=0 encountered.";
336 if (std::abs(
m_pv[1]) > 1.0) {
343 m_w[7] = (std::abs(
m_w[6]) < 1.0) ? 1.0 : 0.0;
377 const double* x,
const double* y,
378 double* phi,
double* theta,
int* stat)
const
381 const double tol = 1.0e-13;
406 const double* xp = x;
408 int rowlen = nx * spt;
409 for (
int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) {
410 double xj = *xp +
m_x0;
411 double* phip = phi + rowoff;
412 for (
int iy = 0; iy < my; ++iy, phip += rowlen) {
418 const double* yp = y;
420 double* thetap = theta;
422 for (
int iy = 0; iy < ny; ++iy, yp += sxy) {
423 double yj = *yp +
m_y0;
424 double yc = yj *
m_w[3];
426 double q =
m_w[0] + yj*
m_w[4];
427 for (
int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt) {
429 double r =
sqrt(xj*xj + yc2);
439 double t = s *
m_pv[1]/std::sqrt(s*s + 1.0);
441 if (std::abs(t) > 1.0) {
442 if (std::abs(t) > 1.0+tol) {
449 t = (t < 0) ? -90.0 : 90.0;
455 double b = s + t + 180.0;
456 if (a > 90.0) a -= 360.0;
457 if (b > 90.0) b -= 360.0;
458 *thetap = (a > b) ? a : b;
496 const double* phi,
const double* theta,
497 double* x,
double* y,
int* stat)
const
522 const double* phip = phi;
524 int rowlen = nphi * sxy;
525 for (
int iphi = 0; iphi < nphi; ++iphi, rowoff += sxy, phip += spt) {
529 double* xp = x + rowoff;
530 double* yp = y + rowoff;
531 for (
int itheta = 0; itheta < mtheta; ++itheta) {
540 const double* thetap = theta;
544 for (
int itheta = 0; itheta < ntheta; ++itheta, thetap += spt) {
552 for (
int iphi = 0; iphi < mphi; ++iphi, xp += sxy, yp += sxy) {
554 double s =
m_w[1]*(*yp);
555 double t = (
m_pv[1] + sinthe) + costhe*s;
568 double r =
m_w[0]*costhe/t;
575 if (*thetap <
m_w[5]) {
582 else if (
m_w[7] > 0.0) {
584 if (std::abs(t) <= 1.0) {
588 double b = s + t + 180.0;
589 if (a > 90.0) a -= 360.0;
590 if (b > 90.0) b -= 360.0;
591 if (*thetap < ((a > b) ? a : b)) {
601 *xp = r*(*xp) -
m_x0;
602 *yp = -r*(*yp) *
m_w[2] -
m_y0;
Exception handler interface definition.
Mathematical function definitions.
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
const GWcsAZP g_wcs_azp_seed
Zenithal/azimuthal perspective (AZP) projection class definition.
World Coordinate Projection registry class interface definition.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
Zenithal/azimuthal perspective (AZP) projection class definition.
void copy_members(const GWcsAZP &wcs)
Copy class members.
void prj_set(void) const
Setup of projection.
GWcsAZP & operator=(const GWcsAZP &wcs)
Assignment operator.
void init_members(void)
Initialise class members.
virtual void clear(void)
Clear instance.
GWcsAZP(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 ~GWcsAZP(void)
Destructor.
void free_members(void)
Delete class members.
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 std::string print(const GChatter &chatter=NORMAL) const
Print WCS information.
virtual GWcsAZP * clone(void) const
Clone instance.
Interface definition for the WCS registry class.
Abstract world coordinate system base class.
void free_members(void)
Delete class members.
void prj_off(const double &phi0, const double &theta0) const
Compute fiducial offset to force (x,y) = (0,0) at (phi0,theta0)
virtual GWcs & operator=(const GWcs &wcs)
Assignment operator.
std::string wcs_print(const GChatter &chatter=NORMAL) const
Print WCS information.
void init_members(void)
Initialise class members.
double m_pv[PVN]
Projection parameters.
void wcs_set(void) const
Setup of World Coordinate System.
bool m_bounds
Enable strict bounds checking.
bool m_prjset
Projection is set.
std::vector< double > m_w
Intermediate values.
double m_y0
Fiducial y offset.
double m_x0
Fiducial x offset.
double m_r0
Radius of the generating sphere.
bool undefined(const double &value) const
Check if value is undefined.
void sincosd(const double &angle, double *s, double *c)
Compute sine and cosine of angle in degrees.
double asind(const double &value)
Compute arc sine in degrees.
double cosd(const double &angle)
Compute cosine of angle in degrees.
double sind(const double &angle)
Compute sine of angle in degrees.
void check_prj_s2x_status(const std::string &origin, const int &status, const int &number)
Checks status of GWcs::prj_s2x method.
double atan2d(const double &y, const double &x)
Compute arc tangens in degrees.
double atand(const double &value)
Compute arc tangens in degrees.
void check_prj_x2s_status(const std::string &origin, const int &status, const int &number)
Checks status of GWcs::prj_x2s method.