itinero / routing

The routing core of itinero.
Apache License 2.0
220 stars 70 forks source link

Direction calculator / calculate angle fails if two latitudes are the same (gives NaN) #294

Closed pietervdvn closed 4 years ago

pietervdvn commented 4 years ago
var shape = new Coordinate(50.71287f, 4.555358f);
        var nextShape = new Coordinate(50.71287f, 4.55207f);
        var bearingOut = DirectionCalculator.Angle(
            nextShape,
            shape,
            new Coordinate(shape.Latitude + 0.01f /* perfectly north of the shapepoint*/,
                shape.Longitude)).ToDegrees().NormalizeDegrees();
        Assert.False(double.IsNaN(bearingOut));
pietervdvn commented 4 years ago

Fixed in fe42bf8297c51c64518775a4de507c87e649b4e0 and 867d6e7cb5d63e7ea5e47a683b2550dd3739f1ff