public LatLon Add(Position that) { if (that == null) { throw new ArgumentException("Angle Is Null"); } Angle lat = Angle.NormalizeLatitude(this.latitude.Add(that.Latitude)); Angle lon = Angle.NormalizeLongitude(this.longitude.Add(that.Longitude)); return new LatLon(lat, lon); }
public new Position Add(Position that) { Angle lat = Angle.NormalizeLatitude(this.latitude.Add(that.latitude)); Angle lon = Angle.NormalizeLongitude(this.longitude.Add(that.longitude)); return new Position(lat, lon, this.elevation + that.elevation); }
public new Position Subtract(Position that) { Angle lat = Angle.NormalizeLatitude(this.latitude.Subtract(that.latitude)); Angle lon = Angle.NormalizeLongitude(this.longitude.Subtract(that.longitude)); return new Position(lat, lon, this.elevation - that.elevation); }
/** * Returns the an interpolated location along the rhumb line between <code>value1</code> and <code>value2</code>. * The position's elevation components are linearly interpolated as a simple 1D scalar value. The interpolation * factor <code>amount</code> defines the weight given to each value, and is clamped to the range [0, 1]. If * <code>a</code> is 0 or less, this returns <code>value1</code>. If <code>amount</code> is 1 or more, this returns * <code>value2</code>. Otherwise, this returns the position on the rhumb line between <code>value1</code> and * <code>value2</code> with a linearly interpolated elevation component, and corresponding to the specified * interpolation factor. * * @param amount the interpolation factor * @param value1 the first position. * @param value2 the second position. * * @return an interpolated position along the great-arc between <code>value1</code> and <code>value2</code>, with a * linearly interpolated elevation component. * * @throws IllegalArgumentException if either location is null. */ public static Position interpolateRhumb(double amount, Position value1, Position value2) { throw new NotImplementedException(); /* if (value1 == null || value2 == null) { throw new IllegalArgumentException("Position Is Null"); } LatLon latLon = LatLon.interpolateRhumb(amount, value1, value2); // Elevation is independent of geographic interpolation method (i.e. rhumb, great-circle, linear), so we // interpolate elevation linearly. double elevation = WWMath.mix(amount, value1.getElevation(), value2.getElevation()); return new Position(latLon, elevation); */ }