Skip to content

Conversation

@pranjalya-singh
Copy link

When the function distanceCalculator calls the function createPath, it passes the coordinates in the format (longitude, latitude). But while creating the indices on path, the function route_through_array again takes the input in reversed format. Hence the returned indices are in the format (latitude_index, longitude_index) which is then converted to (latitudes,longitudes). And this is returned from createPath. So when distanceCalculator calls calculateDistance, it is actually passing the coordinates in (Latitude, Longitudes) order. Hence there is not need to reverse that order while calculating distance.

The edit in the test case is just to make the stopCoord latitude be fetched from the same port entry as its longitude. It was mistakenly written as ports.latitude[100] when it should have been ports.latitude[1000].

When the function distanceCalculator calls the function createPath, it passes the coordinates in the format (longitude, latitude). But while creating the indices on path, the function route_through_array again takes the input in reversed format. Hence the returned indices are in the format (latitude_index, longitude_index) which is then converted to (latitudes,longitudes). And this is returned from createPath. So when distanceCalculator calls calculateDistance, it is actually passing the coordinates in (Latitude, Longitudes) order. Hence there is not need to reverse that order while calculating distance.

The edit in the test case is just to make the stopCoord latitude be fetched from the same port entry as its longitude. It was mistakenly written as ports.latitude[100] when it should have been ports.latitude[1000].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant