Example #1
0
        private static void SphToMapTransform(double theta, double phi, out double azimuth, out double elevation, bool enable_move_pole = true)
        {
            if (enable_move_pole)
            {
                prjmap_coords.Transform(ref theta, ref phi);
            }

            azimuth = phi * 180.0 / Math.PI;
#if false
            elevation = theta * 180.0 / Math.PI;
#else
            double angle = (theta - Math.PI / 2) * map_pole_enlarge_scale + Math.PI / 2;
            double scale = Math.Cos(Math.PI / 2 * (1.0 - map_pole_enlarge_scale));
            elevation = (1.0 - (Math.Cos(angle) / scale)) * 90.0;
#endif

            if (elevation < 0)
            {
                elevation += 360;
            }
            if (azimuth < 0)
            {
                azimuth += 360;
            }
            if (elevation > 360)
            {
                elevation -= 360;
            }
            if (azimuth > 360)
            {
                azimuth -= 360;
            }
        }
Example #2
0
 public void SetPolePositionRelative(double theta1, double phi1, double theta2, double phi2)
 {
     if ((theta1 != theta2) || (phi1 != phi2))
     {
         ProjectionMapCoordsTrans trans = new ProjectionMapCoordsTrans();
         trans.SetRotationByGreatCircle(theta1, phi1, theta2, phi2);
         double theta = theta0;
         double phi   = phi0;
         trans.Transform(ref theta, ref phi);
         SetPolePositionAbsolute(theta, phi);
     }
 }