robust-in-sphere
Exact arithmetic test to check if point is contained in sphere
npm install robust-in-sphere
Want to see pretty graphs? Log in now!
8 | downloads in the last week |
24 | downloads in the last month |
Last Published By | |
---|---|
Version | 1.0.1 last updated 20 days ago |
License | MIT |
Keywords | sphere, robust, geometric, predicate, exact, geometry |
Repository | git://github.com/mikolalysenko/robust-in-sphere.git (git) |
Homepage | https://github.com/mikolalysenko/robust-in-sphere |
Bugs | https://github.com/mikolalysenko/robust-in-sphere/issues |
Dependencies | robust-scale, robust-sum, two-product, robust-subtract |
Dependents | incremental-delaunay, mikolalysenko-hoarders |
robust-in-sphere
Exact arithmetic test to check if (n+2) points are cospherical.
(Very) loosely inspired by Jonathan Shewchuk's work on robust predicates. Currently not as fast, but pull requests are welcome.
Example
var inSphere = require("robust-in-sphere")
console.log(inSphere(
[0, 1],
[1, 0],
[-1, 0],
[0, -1]))
require("robust-in-sphere")(a,b,c,...)
Tests if a collection of n+2
points in n
-dimensional space are cospherical or if the last point is contained in the sphere or not.
a,b,c,...
is a list of points
Returns A signed integer that gives the orientation of the points
>0
if the last point is contained in the oriented sphere defined by the previous two points<0
if the last point is outside the sphere0
is the points are cospherical
Credits
(c) 2014 Mikola Lysenko. MIT License