Skip to content

Instantly share code, notes, and snippets.

@Phyyl
Created November 26, 2015 01:40
Show Gist options
  • Save Phyyl/6ea10b1cbcf41bb89f65 to your computer and use it in GitHub Desktop.
Save Phyyl/6ea10b1cbcf41bb89f65 to your computer and use it in GitHub Desktop.
private string CalcLatitude()
{
float reste = (float)Math.Abs(Y - 0.5f) * 180;
int deg = (int)reste;
reste -= deg;
reste *= 60;
int min = (int)reste;
reste -= min;
reste *= 60;
int sec = (int)reste;
return string.Format("{0}° {1}' {2}\" {3}", deg, min, sec, Y > 0.5f ? "S" : "N");
}
/// <summary>
/// Calcul de la longitude
/// </summary>
/// <returns>Longitude</returns>
private string CalcLongitude()
{
float reste = (float)Math.Abs(X - 0.5f) * 360;
int deg = (int)reste;
reste -= deg;
reste *= 60;
int min = (int)reste;
reste -= min;
reste *= 60;
int sec = (int)reste;
return string.Format("{0}° {1}' {2}\" {3}", deg, min, sec, X > 0.5f ? "E" : "W");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment