@aureooms/js-convex-hull-2d
v3.0.0
Published
Convex hull algorithms in R^2 code bricks for JavaScript
Downloads
10
Maintainers
Readme
js-convex-hull-2d
Convex hull algorithms in two dimensions. Parent is aureooms/js-cg.
// * - < - * - < - *
// / \
// hi[0] = lo[0] * * hi[p + 1] = lo[q + 1]
// \ /
// * - > - * - > - *
Can be managed through jspm, duo, component, bower, ender, jam, spm, and npm.
Install
jspm
jspm install github:aureooms/js-convex-hull-2d
# or
jspm install npm:@aureooms/js-convex-hull-2d
duo
No install step needed for duo!
component
component install aureooms/js-convex-hull-2d
bower
bower install @aureooms/js-convex-hull-2d
ender
ender add @aureooms/js-convex-hull-2d
jam
jam install @aureooms/js-convex-hull-2d
spm
spm install @aureooms/js-convex-hull-2d --save
npm
npm install @aureooms/js-convex-hull-2d --save
Require
jspm
let convexhull2d = require( "github:aureooms/js-convex-hull-2d" ) ;
// or
import convexhull2d from '@aureooms/js-convex-hull-2d' ;
duo
let convexhull2d = require( "aureooms/js-convex-hull-2d" ) ;
component, ender, spm, npm
let convexhull2d = require( "@aureooms/js-convex-hull-2d" ) ;
bower
The script tag exposes the global variable convexhull2d
.
<script src="bower_components/@aureooms/js-convex-hull-2d/js/dist/convex-hull-2d.min.js"></script>
Alternatively, you can use any tool mentioned here.
jam
require( [ "@aureooms/js-convex-hull-2d" ] , function ( convexhull2d ) { ... } ) ;
Space
The 2^d space system object must have the following static methods:
space.crs( a , b , c ) ; // compute the cross product of ab and bc
space.dot( a , b , c ) ; // compute the dot product of ab and bc
space.col( a , b , c ) ; // test whether 3 points are colinear
space.pit( x , a , b , c ) ; // test whether x is in triangle abc
space.lex( a , b ) ; // > 0 if a comes before b in lex order
space.colex( a , b ) ; // > 0 if a comes before b in colex order
space.ccw( crs , dot , x ) ; // defines a counter clockwise ordering around x
Reference
- https://github.com/mikolalysenko/convex-hull