mapbox / mapbox/mapbox-java

TurfMeasurements should have a function for determining bearing deltas

Open
#1,264 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

jira-sync-complete
Dominant language
Java
Stars
438
Forks
117
PR merge metrics
No merged PRs in 30d

Description

TurfMeasurement.bearing(Point point1, Point point2

This function can return -180.0, 180.0.

In order to calculate the difference between two bearings. Downstream needs to create a normalizing function which can determine that the difference between -179.0 and 179.0, is 2 degrees.

double TurfMeasurements.shortestBearingDiff(double bearing1, double bearing2) {
  ...
}

This function should be proven with unit tests.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading services-turf/src/main/java/com/mapbox/turf/TurfMeasurement.java, especially the bearing function referenced in the issue. Add the requested bearing-difference function and unit tests covering the -179.0 and 179.0 case, including the possible -180.0 and 180.0 results; done means the tests prove the shortest difference.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.