public void Zero(int seed) { Random randomizer = new Random(seed); Position3D reference = new Position3D( new Latitude(randomizer.NextDouble() * 180 - 90), new Longitude(randomizer.NextDouble() * 360 - 180), new Distance(randomizer.NextDouble() * 1000, DistanceUnit.Meters)); Position3D position = reference; NedPoint nedPoint = position.ToNedPoint(reference); Assert.AreEqual(0.0, nedPoint.N.InMeters(), 0.001, "North incorrect"); Assert.AreEqual(0.0, nedPoint.E.InMeters(), 0.001, "East incorrect"); Assert.AreEqual(0.0, nedPoint.D.InMeters(), 0.001, "Down incorrect"); }
public void ZeroReversable(int seed) { Random randomizer = new Random(seed); Position3D reference = new Position3D( new Latitude(randomizer.NextDouble() * 180 - 90), new Longitude(randomizer.NextDouble() * 360 - 180), new Distance(randomizer.NextDouble() * 1000, DistanceUnit.Meters)); Position3D position = reference; NedPoint nedPoint = position.ToNedPoint(reference); Position3D reversed = nedPoint.ToPosition3D(reference); Assert.AreEqual(reference.Latitude.InDegrees(), reversed.Latitude.InDegrees(), 0.001, "Latitude incorrect"); Assert.AreEqual(reference.Longitude.InDegrees(), reversed.Longitude.InDegrees(), 0.001, "Longitude incorrect"); Assert.AreEqual(reference.Altitude.InMeters(), reversed.Altitude.InMeters(), 0.001, "Altitude incorrect"); }