@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
42 lines (32 loc) • 887 B
JavaScript
import { orient3d } from "robust-predicates";
/**
*
* @param {number[]} points
* @param {number} a index of point a
* @param {number} b index of point b
* @param {number} c index of point c
* @param {number} d index of point d
* @returns {number}
*/
export function orient3d_robust(
points,
a, b, c, d
) {
const a3 = a * 3;
const b3 = b * 3;
const c3 = c * 3;
const d3 = d * 3;
const ax = points[a3];
const ay = points[a3 + 1];
const az = points[a3 + 2];
const bx = points[b3];
const by = points[b3 + 1];
const bz = points[b3 + 2];
const cx = points[c3];
const cy = points[c3 + 1];
const cz = points[c3 + 2];
const dx = points[d3];
const dy = points[d3 + 1];
const dz = points[d3 + 2];
return orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz);
}