pbrod / nvector

Nvector is a suite of tools written in Python to solve geographical position calculations.
Other
57 stars 7 forks source link

path.positionA not always on path when using the exact method #11

Closed nicolas-UKLSL closed 3 years ago

nicolas-UKLSL commented 3 years ago

Hello,

First of all, thank you for making this package opensource. It is very useful to me. I came across the following issue: on_path when method='exact' will not return consistently True on the positionA of a path. Below is an illustrating example. Having had a quick look at the code under the hood, it may be the checking the difference of azimuth is not meaningful when point_a==point

import nvector as nv
import numpy as np

wgs84 = nv.FrameE(name='WGS84')
pointA = wgs84.GeoPoint(latitude=81, longitude=0, degrees=True)
pointB = wgs84.GeoPoint(latitude=80, longitude=0, degrees=True)
path = nv.GeoPath(pointA, pointB)
print(np.allclose(path.on_path(path.positionA, method='exact'), True))

wgs84 = nv.FrameE(name='WGS84')
pointA = wgs84.GeoPoint(latitude=79, longitude=0, degrees=True)
pointB = wgs84.GeoPoint(latitude=80, longitude=0, degrees=True)
path = nv.GeoPath(pointA, pointB)
print(np.allclose(path.on_path(path.positionA, method='exact'), True))

nvector.version == 0.7.4

pbrod commented 3 years ago

Thank you for reporting this issue. You are absolutely right. If point_a == point the azimuth can be anything and therefore should not be checked. I will fix this soon.

pbrod commented 3 years ago

The issue is fixed in commit f9bfc79

nicolas-UKLSL commented 3 years ago

Thank you