Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Apr 26, 2022
1 parent f380b82 commit d5420c6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,9 @@ export class Address {

const distanceInDegree = distanceInKm / kmPerDegree; // in °

const offsetLatitude = Math.sin(angleRadians) * distanceInDegree;
const newLatitude = coordinate[0] + offsetLatitude;

const offsetLongitude = Math.cos(angleRadians) * distanceInDegree;
const newLongitude = coordinate[1] + offsetLongitude;

const newCoordinate: [latitude: number, longitude: number] = [
newLatitude,
newLongitude,
coordinate[0] + Math.sin(angleRadians) * distanceInDegree,
coordinate[1] + Math.cos(angleRadians) * distanceInDegree,
];

// Box latitude [-90°, 90°]
Expand Down

0 comments on commit d5420c6

Please sign in to comment.