Gathering detailed insights and metrics for robust-predicates
Gathering detailed insights and metrics for robust-predicates
Gathering detailed insights and metrics for robust-predicates
Gathering detailed insights and metrics for robust-predicates
Fast robust predicates for computational geometry in JavaScript
npm install robust-predicates
Typescript
Module System
Node Version
NPM Version
99.8
Supply Chain
95
Quality
75.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
333,732,889
Last Day
952,996
Last Week
4,538,254
Last Month
20,197,903
Last Year
173,655,564
Unlicense License
306 Stars
92 Commits
17 Forks
11 Watchers
2 Branches
4 Contributors
Updated on Mar 21, 2025
Minified
Minified + Gzipped
Latest Version
3.0.2
Package Id
robust-predicates@3.0.2
Unpacked Size
289.07 kB
Size
40.00 kB
File Count
20
NPM Version
9.6.4
Node Version
18.16.0
Published on
May 25, 2023
Cumulative downloads
Total Downloads
Fast robust predicates for computational geometry in JavaScript. Provides reliable 2D and 3D point orientation tests (orient2d
, orient3d
, incircle
, insphere
) that are not susceptible to floating point errors (without sacrificing performance). A modern port of Jonathan R Shewchuk's C code, an industry standard since 1996.
Figure: non-robust vs robust orient2d
test for points within a tiny range (2-42).
Note: unlike J. Shewchuk's original code, all the functions in this library assume y
axis is oriented downwards ↓, so the semantics are different.
orient2d(ax,ay, bx,by, cx,cy)
a
, b
, and c
occur in counterclockwise order (c
lies to the left of the directed line defined by points a
and b
).c
lies to the right of the directed line ab
).The result is also an approximation of twice the signed area of the triangle defined by the three points.
incircle(ax,ay, bx,by, cx,cy, dx,dy)
d
lies outside the circle passing through a
, b
, and c
.The points a
, b
, and c
must be in counterclockwise order, or the sign of the result will be reversed.
orient3d(ax,ay,az, bx,by,bz, cx,cy,cz, dx,dy,dz)
d
lies above the plane passing through a
, b
, and c
, meaning that a
, b
, and c
appear in counterclockwise order when viewed from d
.d
lies below the plane.The result is also an approximation of six times the signed volume of the tetrahedron defined by the four points.
insphere(ax,ay,az, bx,by,bz, cx,cy,cz, dx,dy,dz, ex,ey,ez)
e
lies outside the sphere passing through a
, b
, c
, and d
.The points a
, b
, c
, and d
must be ordered so that they have a positive orientation
(as defined by orient3d
), or the sign of the result will be reversed.
orient2dfast
, orient3dfast
, incirclefast
, inspherefast
Simple, approximate, non-robust versions of predicates above. Use when robustness isn't needed.
1import {orient2d} from 'robust-predicates'; 2 3const ccw = orient2d(ax, ay, bx, by, cx, cy) > 0;
Install with npm install robust-predicates
or yarn add robust-predicates
, or use one of the browser builds:
orient2d
, orient2dfast
)orient3d
, orient3dfast
)incircle
, incirclefast
)insphere
, inspherefast
)This project is just a port — all the brilliant, hard work was done by Jonathan Richard Shewchuk.
The port was also inspired by Mikola Lysenko's excellent Robust Arithmetic Notes and related projects like robust-orientation and robust-in-sphere.
Since the original code is in the public domain, this project follows the same choice. See Unlicense.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-03-24
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
8.4%
952,996
Compared to previous day
Last Week
-1.6%
4,538,254
Compared to previous week
Last Month
8.7%
20,197,903
Compared to previous month
Last Year
95.1%
173,655,564
Compared to previous year