bezierSpline
Description
Takes a line and returns a curved version by applying a Bezier spline algorithm.
The bezier spline implementation is by Leszek Rybicki.
Parameters
Name | Type | Description |
---|---|---|
line | Feature<LineString> | input LineString |
options? | Object | Optional parameters (default {}) |
options.properties? | Object | Translate properties to output (default {}) |
options.resolution? | number | time in milliseconds between points (default 10000) |
options.sharpness? | number | a measure of how curvy the path should be between splines (default 0.85) |
Returns
Feature<LineString> curved line
Examples
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);
Installation
$ npm install @turf/bezier-spline
import { bezierSpline } from "@turf/bezier-spline";
const result = bezierSpline(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.bezierSpline(...);