예제 #1
0
/*
 * Convert from one equinox (or named coordinate system) to another.
 * The first 2 parameters may be numbers, such as "2000" or "1950", or
 * coordinate system names, like "J2000", "FK5", "GALACTIC", "ECLIPTIC", ...
 * Epoch is the besselian epoch in years.
 * If dflag is 1, the ra value was converted to hours by dividing by 15
 */
int WorldCoords::convertEquinox(const char* fromEquinoxStr, const char* toEquinoxStr, double epoch, int dflag)
{
    // check for numerical equinox
    double from_equinox = 0.;
    double to_equinox = 0.;
    if (getEquinox(fromEquinoxStr, from_equinox) == 0 && getEquinox(toEquinoxStr, to_equinox) == 0)
	return convertEquinox(from_equinox, to_equinox);
    
    // convert from one system to another
    int sys1 = wcscsys((char*)fromEquinoxStr);
    if (sys1 == -1)
	return error("bad equinox value: ", fromEquinoxStr);
    int sys2 = wcscsys((char*)toEquinoxStr);
    if (sys2 == -1)
	return error("bad equinox value: ", toEquinoxStr);
    double dtheta = ra_.val();
    if (dflag)
	dtheta *= 15;  // hours to degrees
    double dphi = dec_.val();
    wcscon(sys1, sys2, from_equinox, to_equinox, &dtheta, &dphi, epoch);
    if (sys2 == WCS_J2000 || sys2 == WCS_B1950)
	dtheta /= 15;  // degrees to hours
    ra_ = HMS(dtheta);	
    dec_ = HMS(dphi);
    dec_.show_sign(1);
    return 0;
}
예제 #2
0
double* PPWcsImage::pix2sky(QPointF pos)
{
	if (!wcs)
		return world;
	
	// Get unbinned pixel
	float xf, yf;
	
	xf = M*(pos.x()-1)+2-0.5;
	yf = (M*(pos.y()-1))-0.5;

	pix2wcs(wcs, xf, yf, &world[0], &world[1]);
	
	// Check if coordinates are galatic
	if (wcs->syswcs != WCS_J2000)
		wcscon(wcs->syswcs, WCS_J2000, wcs->equinox, wcs->eqout, &world[0], &world[1], wcs->epoch);
	
	// Perhaps the transformationStatus needs to be checked ...
	return world;
}