Skip to main content
Version: 7.3.0

polygonSmooth

描述

🌐 Description

平滑一个 多边形多多边形。基于 Chaikin 算法。 警告:可能会生成退化多边形。

🌐 Smooths a Polygon or MultiPolygon. Based on Chaikin's algorithm. Warning: may create degenerate polygons.

参数

🌐 Parameters

名称类型描述
inputPolys要素集合<多边形 | 多重多边形> | 要素<多边形 | 多重多边形> | 多边形 | 多重多边形要平滑的(多)多边形
options?对象可选参数 (默认 {})
options.iterations?字符串平滑多边形的次数。值越高,多边形越平滑。(默认 1)

返回

🌐 Returns

FeatureCollection<Polygon | MultiPolygon> 包含平滑多边形/多多边形的要素集合

示例

🌐 Examples

var polygon = turf.polygon([
[
[11, 0],
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0],
],
]);

var smoothed = turf.polygonSmooth(polygon, { iterations: 3 });

安装

🌐 Installation

$ npm install @turf/polygon-smooth

import { polygonSmooth } from "@turf/polygon-smooth";
const result = polygonSmooth(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.polygonSmooth(...);