index.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { Feature, LineString, Properties } from "@turf/helpers";
  2. /**
  3. * Takes a {@link LineString|line} and returns a curved version
  4. * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)
  5. * algorithm.
  6. *
  7. * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).
  8. *
  9. * @name bezierSpline
  10. * @param {Feature<LineString>} line input LineString
  11. * @param {Object} [options={}] Optional parameters
  12. * @param {Object} [options.properties={}] Translate properties to output
  13. * @param {number} [options.resolution=10000] time in milliseconds between points
  14. * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines
  15. * @returns {Feature<LineString>} curved line
  16. * @example
  17. * var line = turf.lineString([
  18. * [-76.091308, 18.427501],
  19. * [-76.695556, 18.729501],
  20. * [-76.552734, 19.40443],
  21. * [-74.61914, 19.134789],
  22. * [-73.652343, 20.07657],
  23. * [-73.157958, 20.210656]
  24. * ]);
  25. *
  26. * var curved = turf.bezierSpline(line);
  27. *
  28. * //addToMap
  29. * var addToMap = [line, curved]
  30. * curved.properties = { stroke: '#0F0' };
  31. */
  32. declare function bezier<P = Properties>(line: Feature<LineString> | LineString, options?: {
  33. properties?: P;
  34. resolution?: number;
  35. sharpness?: number;
  36. }): Feature<LineString, P>;
  37. export default bezier;