
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
The lineclip npm package is a JavaScript library used for clipping lines and polygons to rectangular bounding boxes. It is useful in geographic information systems (GIS) and other applications where you need to clip geometries to a specific area.
Line Clipping
This feature allows you to clip a line to a rectangular bounding box. The code sample demonstrates how to clip a line that crosses the bounding box defined by the coordinates [-5, -5, 5, 5].
const lineclip = require('lineclip');
const line = [[-10, 10], [10, -10]];
const bbox = [-5, -5, 5, 5];
const clippedLine = lineclip(line, bbox);
console.log(clippedLine);
Polygon Clipping
This feature allows you to clip a polygon to a rectangular bounding box. The code sample demonstrates how to clip a polygon that extends beyond the bounding box defined by the coordinates [-5, -5, 5, 5].
const lineclip = require('lineclip');
const polygon = [[-10, 10], [10, 10], [10, -10], [-10, -10], [-10, 10]];
const bbox = [-5, -5, 5, 5];
const clippedPolygon = lineclip.polygon(polygon, bbox);
console.log(clippedPolygon);
The martinez-polygon-clipping package provides advanced polygon clipping capabilities, including union, intersection, difference, and XOR operations. It is more feature-rich compared to lineclip, which focuses primarily on clipping lines and polygons to rectangular bounding boxes.
Turf is a comprehensive geospatial analysis library for JavaScript. It includes a wide range of functionalities, including clipping, buffering, and spatial analysis. While lineclip is specialized in clipping lines and polygons to bounding boxes, Turf offers a broader set of geospatial tools.
A very fast JavaScript library for clipping polylines and polygons by a bounding box.
lineclip(
[[-10, 10], [10, 10], [10, -10]], // line
[0, 0, 20, 20]); // bbox
// returns [[[0, 10], [10, 10], [10, 0]]]
points
— an array of [x, y]
pointsbbox
— a bounding box as [xmin, ymin, xmax, ymax]
result
— an array to append the results toReturns an array of clipped lines.
lineclip
is an alias to lineclip.polyline
.
Returns a clipped polygon.
[[]]
instead of []
.lineclip.polygon
).FAQs
A fast polyline and polygon clipping library.
The npm package lineclip receives a total of 187,726 weekly downloads. As such, lineclip popularity was classified as popular.
We found that lineclip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 28 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
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.