using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace SimpleRadar
{
public class MathCautra
{
/// CRadarGeo message handlers
static double PI = 3.1415926535;
/* conversion degres_radian */
static double degres_radian = PI / 180.0;
/* translation coordonees Cautra 3 Cautra 4 */
static int translationC3 = 4096;
/* Transformation LAMBERT */
static double sin_lt = Math.Sin(47.0 * degres_radian);
/* sinus de la latitude de tangeance */
static double inv_sin_lt = 1.0 / sin_lt;
/* rayon LAMBERT a l'equateur */
static double re = 6327.721;
/* rayon LAMBERT au 47 N */
static double rt = 3201.39922;
///
/// Convertion de coordonnees lat,long en 1/8 nm Cautra4
///
///
///
///
public static PointF ToCautra4(double latitude, double longitude)
{
double a0; /* Angle de convergence */
double r0; /* rayon LAMBERT */
double sin_a0, cos_a0;
double xx;
a0 = longitude * sin_lt * degres_radian;
xx = Math.Tan(PI / 4 - (latitude * degres_radian) / 2.0);
r0 = re * Math.Pow(xx, sin_lt);
sin_a0 = Math.Sin(a0);
cos_a0 = Math.Cos(a0);
return new PointF(
(float)(8.0 * r0 * sin_a0),
(float)(8.0 * (rt - (r0 * cos_a0))));
}
}
}