3.0.12 • Published 8 years ago
turf-bezier v3.0.12
turf-bezier
generate a bezier curve from a linestring
turf.bezier(line, [resolution=10000], [sharpness=0.85])
Takes a LineString|line and returns a curved version by applying a Bezier spline algorithm.
The bezier spline implementation is by Leszek Rybicki.
Parameters
parameter | type | description |
---|---|---|
line | Feature.\<LineString> | input LineString |
[resolution=10000] | Number | optional: time in milliseconds between points |
[sharpness=0.85] | Number | optional: a measure of how curvy the path should be between splines |
Example
var line = {
"type": "Feature",
"properties": {
"stroke": "#f00"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-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.bezier(line);
curved.properties = { stroke: '#0f0' };
var result = {
"type": "FeatureCollection",
"features": [line, curved]
};
//=result
Returns Feature.<LineString>
, curved line
Installation
Requires nodejs.
$ npm install turf-bezier
Tests
$ npm test
3.0.12
8 years ago
3.0.10
8 years ago
3.0.7-canary.ae89c8b3
8 years ago
3.0.7
8 years ago
3.0.6
8 years ago
3.0.5-canary.4f73aa1a
8 years ago
3.0.5
8 years ago
3.0.1
8 years ago
3.0.0-canary.7879bf6c
8 years ago
3.0.0-canary.2f5f7167
8 years ago
1.0.3
8 years ago
1.0.2
9 years ago
1.0.0
9 years ago
0.0.0
10 years ago