Package Exports
- @thi.ng/geom-clip-line
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@thi.ng/geom-clip-line) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
This project is part of the @thi.ng/umbrella monorepo.
About
2D line clipping (Liang-Barsky).
Current implementation is based on toxiclibs (Java) and Clojure version thi.ng/geom-clj.
This package has been extracted from the former (now obsolete) @thi.ng/geom-clip package.
Status
STABLE - used in production
Search or submit any issues for this package
Installation
yarn add @thi.ng/geom-clip-line
// ES module
<script type="module" src="https://unpkg.com/@thi.ng/geom-clip-line?module" crossorigin></script>
// UMD
<script src="https://unpkg.com/@thi.ng/geom-clip-line/lib/index.umd.js" crossorigin></script>
Package sizes (gzipped, pre-treeshake): ESM: 532 bytes / CJS: 598 bytes / UMD: 708 bytes
Dependencies
API
liangBarsky2
liangBarksy2Raw
import { liangBarsky2 } from "@thi.ng/geom-clip-line";
liangBarsky2(
// line end points
[-10, -20], [30, 400],
// min/max clip rect
[0, 0], [100, 200]
)
// [ [ 0, 85 ], [ 10.952380952380953, 200 ], 0.25, 0.5238095238095238 ]
// returns undefined if line is completely outside the clip rect
liangBarsky2(
// line end points
[-10, -20], [-30, 400],
// min/max bbox
[0, 0], [100, 200]
)
// undefined
Authors
Karsten Schmidt
License
© 2013 - 2020 Karsten Schmidt // Apache Software License 2.0