🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Repository files navigation

lineclip Simply Awesome

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]]]

API

clipPolyline(points, bbox[, result])

  • points — an array of [x, y] points
  • bbox — a bounding box as [xmin, ymin, xmax, ymax]
  • result — an array to append the results to

Returns an array of clipped lines.

lineclip is an alias to lineclip.polyline.

clipPolygon(points, bbox)

Returns a clipped polygon.

About

A very fast JavaScript polyline and polygon clipping library

Resources

Code of conduct

Contributing

Security policy

Stars

183 stars

Watchers

114 watching

Forks

Releases

Packages

Used by

Contributors

Languages