
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
triangle-triangle-intersection-js
Advanced tools
[](https://github.com/LokiResearch/triangle-triangle-intersection-js/actions/workflows/node.js.yml)
Fast triangle-triangle intersection computation with high precision and cross/coplanar triangles handling.
Typescript definitions are included.
npm i triangle-triangle-intersection-js
trianglesIntersect(t1: Triangle, t2: Triangle, target?: Array<Vector3>): Intersection
Computes wether triangle t1 and t2 are intersecting and returns Intersection.Cross if triangles are cross-intersecting, Intersection.Coplanar if triangles are coplanar-intersecting, otherwise returns null.
If target array is given, it is emptied and intersection points are then computed and put in the array.
Check if triangles are simply intersecting.
import {Triangle} from 'three';
import {trianglesIntersect, Intersection} from 'triangle-triangle-intersection-js';
const t1 = new Triangle();
t1.a.set(-1, 0, 0);
t1.b.set(2, 0, -2);
t1.c.set(2, 0, 2);
const t2 = new Triangle();
t2.a.set(1, 0, 0);
t2.b.set(-2, -2, 0);
t2.c.set(-2, 2, 0);
const intersection = trianglesIntersect(t1, t2);
if (intersection === Intersection.Cross) {
console.log("Triangles are cross-intersecting.");
} else if (intersection === Intersection.Coplanar) {
console.log("Triangles are coplanar-intersecting.");
} else {
console.log("Triangles are not intersecting.");
}
Obtening the intersection points.
const points = new Array<Vector3>();
if (trianglesIntersect(t1, t2, points)) {
console.log("Intersection points: ", points) // [Vector3(1, 0, 0), Vector3(-1, 0, 0)]
}
This algorithm is based on this publication.
@techreport{devillers:inria-00072100,
TITLE = {{Faster Triangle-Triangle Intersection Tests}},
AUTHOR = {Devillers, Olivier and Guigue, Philippe},
URL = {https://hal.inria.fr/inria-00072100},
NUMBER = {RR-4488},
INSTITUTION = {{INRIA}},
YEAR = {2002},
MONTH = Jun,
KEYWORDS = {LOW DEGREE PREDICATE ; COLLISION DETECTION ; GEOMETRIC PREDICATES},
PDF = {https://hal.inria.fr/inria-00072100/file/RR-4488.pdf},
HAL_ID = {inria-00072100},
HAL_VERSION = {v1},
}
FAQs
[](https://github.com/LokiResearch/triangle-triangle-intersection-js/actions/workflows/node.js.yml)
We found that triangle-triangle-intersection-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.