
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@turf/bezier-spline
Advanced tools
@turf/bezier-spline is a module in the Turf.js library that allows you to create smooth Bezier spline curves from a set of points. This is particularly useful in geographic information systems (GIS) for creating smooth paths or routes on a map.
Create Bezier Spline from Points
This feature allows you to create a smooth Bezier spline curve from a set of points. The `resolution` option controls the number of points in the resulting spline, and `sharpness` controls the curvature.
const turf = require('@turf/turf');
const points = turf.lineString([
[-75.343, 39.984],
[-75.534, 39.123],
[-75.123, 39.543],
[-75.534, 39.123],
[-75.343, 39.984]
]);
const options = { resolution: 10000, sharpness: 0.85 };
const bezierSpline = turf.bezierSpline(points, options);
console.log(JSON.stringify(bezierSpline));
bezier-js is a library for working with Bezier curves in JavaScript. It provides a wide range of functionalities for creating and manipulating Bezier curves, but it is not specifically tailored for geographic data like @turf/bezier-spline.
d3-shape is a part of the D3.js library that provides tools for creating and manipulating shapes, including Bezier curves. While it is very powerful and flexible, it is more general-purpose and not specifically designed for GIS applications.
Paper.js is a vector graphics scripting framework that runs on top of the HTML5 Canvas. It provides a lot of functionalities for working with vector graphics, including Bezier curves. However, it is more focused on graphic design rather than GIS.
Takes a line and returns a curved version by applying a Bezier spline algorithm.
The bezier spline implementation is by Leszek Rybicki.
Parameters
line
Feature<LineString> input LineStringoptions
Object Optional parameters (optional, default {}
)
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);
//addToMap
var addToMap = [line, curved]
curved.properties = { stroke: '#0F0' };
Returns Feature<LineString> curved line
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
$ npm install @turf/bezier-spline
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
6.4.0
@turf/boolean-point-on-line
Added an epislon
option to help in floating point comparison.
(PR https://github.com/Turfjs/turf/pull/2051 - Author @okcoker)@turf/line-slice-along
Fixed a bug where the offset distance equal to the length of the line
(PR https://github.com/Turfjs/turf/pull/2030 - Author @EricPKerr)
@turf/helpers
Fixed the conversion ratio for converting meters to yards and vice-versa
(PR https://github.com/Turfjs/turf/pull/2046 - Author @anotherhale)
@turf/center-median
Fixed a missing TS type import
(PR https://github.com/Turfjs/turf/pull/2044 - Author @Seairth)
`@turf/bezier-spline Fix a bug ensuring the spline result reaches the end of the input (PR https://github.com/Turfjs/turf/pull/2090 - Author @the-nemz)
@turf/transform-rotate
and @turf/ellipse
) Improve documentation for angle parameter
(PR https://github.com/Turfjs/turf/pull/2016 - Author @pasieronen)
@turf/line-chunk
Fix an invalid anchor
(PR https://github.com/Turfjs/turf/pull/2071 - Author @GraxMonzo)
@turf/distance
Enhance distance doco so supported inputs are clearer
(PR https://github.com/Turfjs/turf/pull/2032 - Author @rowanwins)
@turf/concave
Replace deprecated topojson dependency
(PR https://github.com/Turfjs/turf/pull/2037 - Author @elliots)
Work towards enabling TS Strict Mode (PR https://github.com/Turfjs/turf/pull/2053 - Author @mfedderly)
FAQs
turf bezier-spline module
The npm package @turf/bezier-spline receives a total of 576,202 weekly downloads. As such, @turf/bezier-spline popularity was classified as popular.
We found that @turf/bezier-spline demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.