From 058c5928817bc1c12b815f9cf8ba9190bce8a5c2 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 20 Dec 2025 16:15:22 +0100 Subject: [PATCH] Position: fix erroneous condition --- src/main/java/de/serosystems/lib1090/Position.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/serosystems/lib1090/Position.java b/src/main/java/de/serosystems/lib1090/Position.java index 0fb14af..1427e48 100644 --- a/src/main/java/de/serosystems/lib1090/Position.java +++ b/src/main/java/de/serosystems/lib1090/Position.java @@ -146,7 +146,7 @@ public void setAltitudeType(AltitudeType altitudeType) { /** * Calculates the two-dimensional great circle distance (haversine) * @param other position to which we calculate the distance - * @return distance between the this and other position in meters + * @return distance between this and other position in meters */ public Double haversine(Position other) { double lon0r = toRadians(this.longitude); @@ -200,7 +200,7 @@ public static Position fromECEF (double x, double y, double z) { // correct for numerical instability in altitude near exact poles: // after this correction, error is about 2 millimeters, which is about // the same as the numerical precision of the overall function - if (abs(x) < 1 & abs(y) < 1) + if (abs(x) < 1 && abs(y) < 1) alt = abs(z) - b; return new Position(toDegrees(lon), toDegrees(lat), Tools.meters2Feet(alt), AltitudeType.ABOVE_WGS84_ELLIPSOID);