angle
描述
¥Description
查找由 3 个点定义的两个相邻线段之间的夹角。结果将是与 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 | 坐标系 | 起点坐标 |
| midPoint | 坐标系 | 中点坐标 |
| endPoint | 坐标系 | 端点坐标 |
| options? | 对象 | 可选参数(默认值:) |
| options.explementary? | boolean | 返回互补角 (360 - angle)(默认 false) |
| options.mercator? | boolean | 是否应使用墨卡托或 WGS84 投影进行计算(默认 false) |
返回
¥Returns
number 提供的点之间的角度或其补充。
¥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(...);