private void ChordStats() { ChordLength = LatLongCalc.Distance(EndLat, EndLon, StartLat, StartLon); ChordArcAngle = LatLongCalc.Deg2Rad(Math.Abs(StartBrg = EndBrg)); ChordArcLength = ChordArcAngle * ArcRadius; ChordRadius = ChordArcLength / 2; ChordLengthTextBox.Text = ChordLength.ToString("F3"); ChordRadiusTextBox.Text = ChordRadius.ToString("F3"); ChordArcLengthTextBox.Text = ChordArcLength.ToString("F3"); }
public static PointF RotatePoint(PointF pointToRotate, PointF centerPoint, double angleInDegrees) { // Given a center point and point to rotate (aka a line), rotate the line X degrees double radians = LatLongCalc.Deg2Rad(angleInDegrees); double sin = Math.Sin(radians); double cos = Math.Cos(radians); // Translate point back to origin pointToRotate.X -= centerPoint.X; pointToRotate.Y -= centerPoint.Y; // Rotate point double xnew = pointToRotate.X * cos - pointToRotate.Y * sin; double ynew = pointToRotate.X * sin + pointToRotate.Y * cos; // Translate point back PointF newPoint = new PointF((float)xnew + centerPoint.X, (float)ynew + centerPoint.Y); return(newPoint); }
public static double NMperLongDegree() { // Assumes all Lat/Longs are in Decimal degrees double DegPerNMequator = 69.172; double radCenterLat; // Use the user's desired center if possible if (InfoSection.CenterLatitude_Dec == 0) { radCenterLat = LatLongCalc.Deg2Rad((FilterBy.NorthLimit + FilterBy.SouthLimit) / 2); } else { radCenterLat = LatLongCalc.Deg2Rad(InfoSection.CenterLatitude_Dec); } double result = Math.Cos(radCenterLat) * DegPerNMequator; return(result); }