Skip to content

KBE3D / KBCore / turf / bezierSpline

函数: bezierSpline()

bezierSpline<P>(line: LineString | Feature<LineString, GeoJsonProperties>, options?: { properties?: P; resolution?: number; sharpness?: number; }): Feature<LineString, P>

Function

Takes a line and returns a curved version by applying a Bezier spline

algorithm.

The bezier spline implementation is by Leszek Rybicki

.

类型参数

P

P extends GeoJsonProperties = GeoJsonProperties

参数

line

input LineString

LineString | Feature<LineString, GeoJsonProperties>

options?

Optional parameters

properties?

P

Translate properties to output

resolution?

number

time in milliseconds between points

sharpness?

number

a measure of how curvy the path should be between splines

返回

Feature<LineString, P>

curved line

示例

ts
var line = turf.lineString([
  [-76.091308, 18.427501],
  [-76.695556, 18.729501],
  [-76.552734, 19.40443],
  [-74.61914, 19.134789],
  [-73.652343, 20.07657],
  [-73.157958, 20.210656]
]);

var curved = turf.bezierSpline(line);

//addToMap
var addToMap = [line, curved]
curved.properties = { stroke: '#0F0' };

KBE3D @3.0.0 Copyright © 2024-present KBE3D