37 #define G_PRJ_X2S "GWcsSIN::prj_x2s(int, int, int, int, double*, double*,"\
38 " double*, double*, int*)"
39 #define G_PRJ_S2X "GWcsSIN::prj_s2x(int, int, int, int, double*, double*,"\
40 " double*, double*, int*)"
88 const double& crval1,
const double& crval2,
89 const double& crpix1,
const double& crpix2,
90 const double& cdelt1,
const double& cdelt2) :
91 GWcs(coords, crval1, crval2, crpix1, crpix2, cdelt1, cdelt2)
226 result.append(
"=== GWcsSIN ===");
357 const double* x,
const double* y,
358 double* phi,
double* theta,
int* stat)
const
361 const double tol = 1.0e-13;
374 double eta =
m_pv[2];
390 const double* xp = x;
392 int rowlen = nx * spt;
393 for (
int ix = 0; ix < nx; ++ix, rowoff += spt, xp += sxy) {
394 double x0 = (*xp +
m_x0) *
m_w[0];
395 double* phip = phi + rowoff;
396 for (
int iy = 0; iy < my; ++iy, phip += rowlen) {
402 const double* yp = y;
404 double* thetap = theta;
406 for (
int iy = 0; iy < ny; ++iy, yp += sxy) {
407 double y0 = (*yp +
m_y0) *
m_w[0];
409 for (
int ix = 0; ix < mx; ++ix, phip += spt, thetap += spt) {
413 double r2 = x0*x0 + y02;
430 else if (r2 <= 1.0) {
448 double xy = x0*xi + y0*eta;
458 double b = xy -
m_w[1];
459 double c = r2 - xy - xy + m_w[3];
460 double d = b*b - a*c;
476 double sinth1 = (-b + d)/a;
477 double sinth2 = (-b - d)/a;
478 double sinthe = (sinth1 > sinth2) ? sinth1 : sinth2;
480 if (sinthe-1.0 < tol) {
484 sinthe = (sinth1 < sinth2) ? sinth1 : sinth2;
490 if (sinthe+1.0 > -tol) {
496 if (sinthe > 1.0 || sinthe < -1.0) {
511 double x1 = -y0 + eta * z;
512 double y1 = x0 - xi * z;
513 if (x1 == 0.0 && y1 == 0.0) {
561 const double* phi,
const double* theta,
562 double* x,
double* y,
int* stat)
const
587 const double* phip = phi;
589 int rowlen = nphi * sxy;
590 for (
int iphi = 0; iphi < nphi; ++iphi, rowoff += sxy, phip += spt) {
594 double* xp = x + rowoff;
595 double* yp = y + rowoff;
596 for (
int itheta = 0; itheta < mtheta; ++itheta) {
605 const double* thetap = theta;
609 for (
int itheta = 0; itheta < ntheta; ++itheta, thetap += spt) {
620 z = 2.0 - t * t / 2.0;
628 double r =
m_r0 * costhe;
640 for (
int iphi = 0; iphi < mphi; ++iphi, xp += sxy, yp += sxy) {
641 *xp = r*(*xp) -
m_x0;
642 *yp = -r*(*yp) -
m_y0;
656 for (
int iphi = 0; iphi < mphi; ++iphi, xp += sxy, yp += sxy) {
666 *xp = r * (*xp) + z1;
667 *yp = -r * (*yp) + z2;
void init_members(void)
Initialise class members.
Interface definition for the WCS registry class.
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.
Orthographic/synthesis (SIN) projection class definition.
bool undefined(const double &value) const
Check if value is undefined.
void free_members(void)
Delete class members.
void free_members(void)
Delete class members.
World Coordinate Projection registry class interface definition.
double atand(const double &value)
Compute arc tangens in degrees.
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
void wcs_set(void) const
Setup of World Coordinate System.
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 GWcsSIN * clone(void) const
Clone projection.
double acosd(const double &value)
Compute arc cosine in degrees.
void sincosd(const double &angle, double *s, double *c)
Compute sine and cosine of angle in degrees.
virtual GWcs & operator=(const GWcs &wcs)
Assignment operator.
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.
double m_pv[PVN]
Projection parameters.
double m_x0
Fiducial x offset.
void copy_members(const GWcsSIN &wcs)
Copy class members.
virtual ~GWcsSIN(void)
Destructor.
std::string wcs_print(const GChatter &chatter=NORMAL) const
Print WCS information.
void prj_set(void) const
Setup of projection.
void free_members(void)
Delete class members.
std::vector< double > m_w
Intermediate values.
virtual void clear(void)
Clear projection.
Abstract world coordinate system base class.
GWcsSIN(void)
Void constructor.
double m_y0
Fiducial y offset.
double atan2d(const double &y, const double &x)
Compute arc tangens in degrees.
void init_members(void)
Initialise class members.
void check_prj_s2x_status(const std::string &origin, const int &status, const int &number)
Checks status of GWcs::prj_s2x method.
double cosd(const double &angle)
Compute cosine of angle in degrees.
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.
double asind(const double &value)
Compute arc sine in degrees.
bool m_prjset
Projection is set.
void init_members(void)
Initialise class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print projection information.
Orthographic/synthesis (SIN) projection class definition.
const GWcsSIN g_wcs_sin_seed
double sind(const double &angle)
Compute sine of angle in degrees.
GWcsSIN & operator=(const GWcsSIN &wcs)
Assignment operator.
double m_r0
Radius of the generating sphere.
Mathematical function definitions.
bool m_bounds
Enable strict bounds checking.