A very fast JavaScript polyline and polygon clipping library
JavaScript
184
47 commits
updated Jul 12, 2026
A very fast JavaScript library for clipping polylines and polygons by a bounding box.
import {clipPolyline} from 'lineclip';
clipPolyline(
[[-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.
Overall
Maintained
Code review
npm
Latest release
Releases this year
7,377 followers · starred Mar 2017
3,028 followers · starred May 2022
1,874 followers · starred Aug 2021
796 followers · starred Jan 2020
A very fast JavaScript polyline and polygon clipping library
JavaScript
184
47 commits
updated Jul 12, 2026
A very fast JavaScript library for clipping polylines and polygons by a bounding box.
import {clipPolyline} from 'lineclip';
clipPolyline(
[[-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.
Overall
Maintained
Code review
npm
Latest release
Releases this year
7,377 followers · starred Mar 2017
3,028 followers · starred May 2022
1,874 followers · starred Aug 2021
796 followers · starred Jan 2020