lawn_bezier: Curve a linestring

View source: R/bezier.R

lawn_bezierR Documentation

Curve a linestring

Description

Takes a data-LineString and returns a curved version by applying a Bezier http://en.wikipedia.org/wiki/Bezier_spline spline algorithm.

Usage

lawn_bezier(line, resolution = 10000L, sharpness = 0.85, lint = FALSE)

Arguments

line

A data-Feature with a single data-LineString

resolution

Time in milliseconds between points

sharpness

A measure of how curvy the path should be between splines

lint

(logical) Lint or not. Uses geojsonhint. Takes up increasing time as the object to get linted increases in size, so probably use by default for small objects, but not for large if you know they are good geojson objects. Default: FALSE

Value

A data-LineString curved line.

See Also

Other transformations: lawn_buffer(), lawn_concave(), lawn_convex(), lawn_difference(), lawn_intersect(), lawn_merge(), lawn_simplify(), lawn_union()

Examples

pts <- '[
   [-21.964416, 64.148203],
   [-21.956176, 64.141316],
   [-21.93901, 64.135924],
   [-21.927337, 64.136673]
]'
lawn_bezier(lawn_linestring(pts))
lawn_bezier(lawn_linestring(pts), 9000L)
lawn_bezier(lawn_linestring(pts), 9000L, 0.65)
## Not run: 
lawn_bezier(lawn_linestring(pts)) %>% view
lawn_featurecollection(list(lawn_linestring(pts),
  lawn_bezier(lawn_linestring(pts)))) %>% view

## End(Not run)

ropensci/lawn documentation built on May 18, 2022, 9:58 a.m.