Exemplo n.º 1
0
 /**
  * Projects a point from the surface of a sphere onto this projector's plane. The units of the
  * output coordinates are radians, or at least radian-like. In the case of a projection error,
  * the returned coordinates will be NaNs.
  *
  * @param alpha RA of point to be projected
  * @param delta Dec of point to be projected
  * @return (x,y) Cartesian coordinates of projected point
  */
 public double[] project(double alpha, double delta) {
   try {
     AngleDR ad = pal_.Ds2tp(new AngleDR(alpha, delta), ad0_);
     return new double[] {ad.getAlpha(), ad.getDelta()};
   } catch (palError e) {
     return new double[] {Double.NaN, Double.NaN};
   }
 }
Exemplo n.º 2
0
 /**
  * Find a point midway between two given points.
  *
  * @param alpha1 RA of point 1
  * @param delta1 Dec of point 1
  * @param alpha2 RA of point 2
  * @param delta2 Dec of point 2
  * @return (ra,dec) for bisector point
  */
 static double[] bisect(double alpha1, double delta1, double alpha2, double delta2) {
   double[] p1 = pal_.Dcs2c(new AngleDR(alpha1, delta1));
   double[] p2 = pal_.Dcs2c(new AngleDR(alpha2, delta2));
   double[] pc =
       new double[] {(p1[0] + p2[0]) * 0.5, (p1[1] + p2[1]) * 0.5, (p1[2] + p2[2]) * 0.5};
   AngleDR cSph = pal_.Dcc2s(pc);
   return new double[] {cSph.getAlpha(), cSph.getDelta()};
 }
Exemplo n.º 3
0
 /**
  * Takes a point on the tangent plane and works out where it would be on the surface of the
  * sphere.
  *
  * @param x X coordinate of projected point
  * @param y Y coordinate of projected point
  * @return (alpha, delta) coordinates of point that projects to (x,y)
  */
 public double[] unproject(double x, double y) {
   AngleDR ad = pal_.Dtp2s(new AngleDR(x, y), ad0_);
   return new double[] {ad.getAlpha(), ad.getDelta()};
 }