angle
Description
Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise)
angle with origin on the startPoint-midPoint segment, or its explementary angle if required.
Parameters
| Name | Type | Description |
|---|---|---|
| startPoint | Coord | Start Point Coordinates |
| midPoint | Coord | Mid Point Coordinates |
| endPoint | Coord | End Point Coordinates |
| options? | Object | Optional parameters (default {}) |
| options.explementary? | boolean | Returns the explementary angle instead (360 - angle) (default false) |
| options.mercator? | boolean | if calculations should be performed over Mercator or WGS84 projection (default false) |
Returns
number Angle between the provided points, or its explementary.
Examples
turf.angle([5, 5], [5, 6], [3, 4]);
//=45
Installation
$ npm install @turf/angle
import { angle } from "@turf/angle";
const result = angle(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.angle(...);