angle
描述
🌐 Description
查找由三点定义的两个相邻线段形成的角。结果将是以 startPoint-midPoint 线段为起点的(顺时针正角),如果需要,也可以是其余角。
🌐 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
| 名称 | 类型 | 描述 |
|---|---|---|
| startPoint | Coord | 起点坐标 |
| midPoint | Coord | 中点坐标 |
| endPoint | Coord | 终点坐标 |
| options? | Object | 可选参数 (默认 {}) |
| options.explementary? | boolean | 返回补角(360 - 角度)(默认 false) |
| options.mercator? | boolean | 是否应在墨卡托或 WGS84 投影上进行计算 (默认 false) |
返回
🌐 Returns
number 提供点之间的角,或其补角。
示例
🌐 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(...);