@math.gl/geometry 5.0.0-beta.4 → 5.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/color/color-lut-types.d.ts +16 -0
- package/dist/color/color-lut-types.d.ts.map +1 -0
- package/dist/color/color-lut-types.js +5 -0
- package/dist/color/color-lut-types.js.map +1 -0
- package/dist/color/index.cjs +132 -0
- package/dist/color/index.cjs.map +6 -0
- package/dist/color/index.d.ts +4 -0
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/index.js +5 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/sample-lut.d.ts +13 -0
- package/dist/color/sample-lut.d.ts.map +1 -0
- package/dist/color/sample-lut.js +132 -0
- package/dist/color/sample-lut.js.map +1 -0
- package/dist/culling/bounds.d.ts +20 -0
- package/dist/culling/bounds.d.ts.map +1 -0
- package/dist/culling/bounds.js +121 -0
- package/dist/culling/bounds.js.map +1 -0
- package/dist/culling/frustum-planes.d.ts +5 -0
- package/dist/culling/frustum-planes.d.ts.map +1 -0
- package/dist/culling/frustum-planes.js +37 -0
- package/dist/culling/frustum-planes.js.map +1 -0
- package/dist/culling/geometric-queries.d.ts +34 -0
- package/dist/culling/geometric-queries.d.ts.map +1 -0
- package/dist/culling/geometric-queries.js +208 -0
- package/dist/culling/geometric-queries.js.map +1 -0
- package/dist/culling/index.cjs +917 -514
- package/dist/culling/index.cjs.map +3 -3
- package/dist/culling/index.d.ts +5 -1
- package/dist/culling/index.d.ts.map +1 -1
- package/dist/culling/index.js +3 -0
- package/dist/culling/index.js.map +1 -1
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts +3 -3
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts.map +1 -1
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js +25 -8
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js.map +1 -1
- package/dist/culling/lib/culling-volume.d.ts +3 -0
- package/dist/culling/lib/culling-volume.d.ts.map +1 -1
- package/dist/culling/lib/culling-volume.js +7 -0
- package/dist/culling/lib/culling-volume.js.map +1 -1
- package/dist/culling/lib/ray.d.ts +5 -0
- package/dist/culling/lib/ray.d.ts.map +1 -1
- package/dist/culling/lib/ray.js +21 -0
- package/dist/culling/lib/ray.js.map +1 -1
- package/dist/curves/adaptive-sampling.d.ts +16 -0
- package/dist/curves/adaptive-sampling.d.ts.map +1 -0
- package/dist/curves/adaptive-sampling.js +59 -0
- package/dist/curves/adaptive-sampling.js.map +1 -0
- package/dist/curves/index.d.ts +4 -0
- package/dist/curves/index.d.ts.map +1 -1
- package/dist/curves/index.js +2 -0
- package/dist/curves/index.js.map +1 -1
- package/dist/curves/parallel-transport.d.ts +12 -0
- package/dist/curves/parallel-transport.d.ts.map +1 -0
- package/dist/curves/parallel-transport.js +83 -0
- package/dist/curves/parallel-transport.js.map +1 -0
- package/dist/index.cjs +1336 -699
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lighting/index.cjs +175 -0
- package/dist/lighting/index.cjs.map +6 -0
- package/dist/lighting/index.d.ts +4 -0
- package/dist/lighting/index.d.ts.map +1 -0
- package/dist/lighting/index.js +5 -0
- package/dist/lighting/index.js.map +1 -0
- package/dist/lighting/lighting-types.d.ts +16 -0
- package/dist/lighting/lighting-types.d.ts.map +1 -0
- package/dist/lighting/lighting-types.js +5 -0
- package/dist/lighting/lighting-types.js.map +1 -0
- package/dist/lighting/photometry.d.ts +36 -0
- package/dist/lighting/photometry.d.ts.map +1 -0
- package/dist/lighting/photometry.js +181 -0
- package/dist/lighting/photometry.js.map +1 -0
- package/dist/utils/project-bounds.d.ts +44 -0
- package/dist/utils/project-bounds.d.ts.map +1 -0
- package/dist/utils/project-bounds.js +93 -0
- package/dist/utils/project-bounds.js.map +1 -0
- package/dist/utils/project-texture-coordinates.d.ts +19 -0
- package/dist/utils/project-texture-coordinates.d.ts.map +1 -0
- package/dist/utils/project-texture-coordinates.js +49 -0
- package/dist/utils/project-texture-coordinates.js.map +1 -0
- package/package.json +15 -3
- package/src/color/color-lut-types.ts +19 -0
- package/src/color/index.ts +6 -0
- package/src/color/sample-lut.ts +175 -0
- package/src/culling/bounds.ts +152 -0
- package/src/culling/frustum-planes.ts +41 -0
- package/src/culling/geometric-queries.ts +299 -0
- package/src/culling/index.ts +37 -1
- package/src/culling/lib/bounding-volumes/axis-aligned-bounding-box.ts +26 -8
- package/src/culling/lib/culling-volume.ts +9 -1
- package/src/culling/lib/ray.ts +21 -0
- package/src/curves/adaptive-sampling.ts +85 -0
- package/src/curves/index.ts +4 -0
- package/src/curves/parallel-transport.ts +104 -0
- package/src/index.ts +44 -0
- package/src/lighting/index.ts +10 -0
- package/src/lighting/lighting-types.ts +20 -0
- package/src/lighting/photometry.ts +264 -0
- package/src/utils/project-bounds.ts +154 -0
- package/src/utils/project-texture-coordinates.ts +67 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { getProjectionDepthRange } from '@math.gl/core';
|
|
5
|
+
import { Plane } from "./lib/plane.js";
|
|
6
|
+
/** Inward planes: left, right, bottom, top, near, far. An infinite far plane is omitted. */
|
|
7
|
+
export function extractFrustumPlanes(matrix, options = {}) {
|
|
8
|
+
if (matrix.length !== 16 || Array.from(matrix).some(x => !Number.isFinite(x)))
|
|
9
|
+
throw new RangeError('Expected a finite view-projection matrix');
|
|
10
|
+
const [near, far] = getProjectionDepthRange(options);
|
|
11
|
+
const low = Math.min(near, far), high = Math.max(near, far);
|
|
12
|
+
const row = (i) => [matrix[i], matrix[i + 4], matrix[i + 8], matrix[i + 12]];
|
|
13
|
+
const x = row(0), y = row(1), z = row(2), w = row(3);
|
|
14
|
+
const combine = (a, b, factor) => a.map((v, i) => v + factor * b[i]);
|
|
15
|
+
const lo = combine(z, w, -low), hi = w.map((v, i) => high * v - z[i]);
|
|
16
|
+
const coefficients = [
|
|
17
|
+
combine(w, x, 1),
|
|
18
|
+
combine(w, x, -1),
|
|
19
|
+
combine(w, y, 1),
|
|
20
|
+
combine(w, y, -1),
|
|
21
|
+
...(options.reversedDepth ? [hi, lo] : [lo, hi])
|
|
22
|
+
];
|
|
23
|
+
const planes = [];
|
|
24
|
+
for (const [a, b, c, d] of coefficients) {
|
|
25
|
+
const length = Math.hypot(a, b, c);
|
|
26
|
+
if (length === 0) {
|
|
27
|
+
if (d < 0)
|
|
28
|
+
throw new RangeError('Empty clipping volume');
|
|
29
|
+
}
|
|
30
|
+
else
|
|
31
|
+
planes.push(new Plane([a / length, b / length, c / length], d / length));
|
|
32
|
+
}
|
|
33
|
+
if (planes.length < 4)
|
|
34
|
+
throw new RangeError('Degenerate clipping volume');
|
|
35
|
+
return planes;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=frustum-planes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frustum-planes.js","sourceRoot":"","sources":["../../src/culling/frustum-planes.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAC5D,OAAO,EAAC,uBAAuB,EAA8B,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,KAAK,EAAC,uBAAoB;AAElC,4FAA4F;AAC5F,MAAM,UAAU,oBAAoB,CAClC,MAAyB,EACzB,UAAkC,EAAE;IAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3E,MAAM,IAAI,UAAU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CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACjB,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;KACjD,CAAC;IACF,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACnC,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,UAAU,CAAC,uBAAuB,CAAC,CAAC;QAC3D,CAAC;;YAAM,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NumericArray } from '@math.gl/core';
|
|
2
|
+
import { type QueryPoint } from "./queries.js";
|
|
3
|
+
type V = [number, number, number];
|
|
4
|
+
export declare function getRayPoint(origin: QueryPoint, dir: QueryPoint, t: number, out?: NumericArray): NumericArray;
|
|
5
|
+
export declare function getClosestPointOnRay(point: QueryPoint, origin: QueryPoint, dir: QueryPoint, out?: NumericArray): NumericArray;
|
|
6
|
+
export declare function distanceToRay(point: QueryPoint, origin: QueryPoint, dir: QueryPoint): number;
|
|
7
|
+
export type RaySegmentClosestPoints = {
|
|
8
|
+
rayPoint: V;
|
|
9
|
+
segmentPoint: V;
|
|
10
|
+
rayParameter: number;
|
|
11
|
+
segmentFraction: number;
|
|
12
|
+
distance: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function getClosestPointsRaySegment(origin: QueryPoint, dir: QueryPoint, a: QueryPoint, b: QueryPoint): RaySegmentClosestPoints;
|
|
15
|
+
/** Finite affine transforms only. The unnormalized output direction preserves the ray parameter. */
|
|
16
|
+
export declare function transformRay(origin: QueryPoint, dir: QueryPoint, matrix: QueryPoint): {
|
|
17
|
+
origin: V;
|
|
18
|
+
direction: V;
|
|
19
|
+
};
|
|
20
|
+
/** Barycentrics of the point's orthogonal projection; null for a degenerate triangle. */
|
|
21
|
+
export declare function getTriangleBarycentric(point: QueryPoint, a: QueryPoint, b: QueryPoint, c: QueryPoint, out?: NumericArray): NumericArray | null;
|
|
22
|
+
export declare function getTriangleArea(a: QueryPoint, b: QueryPoint, c: QueryPoint): number;
|
|
23
|
+
export declare function getTriangleNormal(a: QueryPoint, b: QueryPoint, c: QueryPoint, out?: NumericArray): NumericArray;
|
|
24
|
+
/** Front-facing means the oriented normal points against the viewing/ray direction. */
|
|
25
|
+
export declare function isTriangleFrontFacing(a: QueryPoint, b: QueryPoint, c: QueryPoint, dir: QueryPoint): boolean;
|
|
26
|
+
/** Relative tolerance: plane distance is scaled by the longest edge from a. */
|
|
27
|
+
export declare function triangleContainsPoint(point: QueryPoint, a: QueryPoint, b: QueryPoint, c: QueryPoint, tolerance?: number): boolean;
|
|
28
|
+
export declare function interpolateTriangleAttribute(weights: QueryPoint, a: QueryPoint, b: QueryPoint, c: QueryPoint, out?: NumericArray): NumericArray;
|
|
29
|
+
/** Closed segment; a coplanar segment returns its start, a disjoint segment returns null. */
|
|
30
|
+
export declare function intersectPlaneSegment(normal: QueryPoint, constant: number, start: QueryPoint, end: QueryPoint, out?: NumericArray): NumericArray | null;
|
|
31
|
+
/** Separating-axis test for a closed AABB. Degenerate triangles reduce to segments/points. */
|
|
32
|
+
export declare function triangleIntersectsBounds(a: QueryPoint, b: QueryPoint, c: QueryPoint, minimum: QueryPoint, maximum: QueryPoint): boolean;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=geometric-queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometric-queries.d.ts","sourceRoot":"","sources":["../../src/culling/geometric-queries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAA8C,KAAK,UAAU,EAAC,qBAAkB;AAEvF,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAqBlC,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EACf,CAAC,EAAE,MAAM,EACT,GAAG,GAAE,YAAwB,GAC5B,YAAY,CAMd;AACD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EACf,GAAG,GAAE,YAAwB,GAC5B,YAAY,CASd;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,MAAM,CAG5F;AACD,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,CAAC,CAAC;IACZ,YAAY,EAAE,CAAC,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EACf,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,GACZ,uBAAuB,CAkDzB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AAG,GAAE,YAAwB,GAC5B,YAAY,GAAG,IAAI,CAcrB;AACD,8FAA8F;AAC9F,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACb,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,UAAU,GAClB,OAAO,CA0BT"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { validateQueryPoint, normalizeQueryDirection } from "./queries.js";
|
|
2
|
+
const sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
3
|
+
const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
4
|
+
const cross = (a, b) => [
|
|
5
|
+
a[1] * b[2] - a[2] * b[1],
|
|
6
|
+
a[2] * b[0] - a[0] * b[2],
|
|
7
|
+
a[0] * b[1] - a[1] * b[0]
|
|
8
|
+
];
|
|
9
|
+
const check = (...points) => {
|
|
10
|
+
for (const p of points)
|
|
11
|
+
validateQueryPoint(p, 3);
|
|
12
|
+
};
|
|
13
|
+
function output(out, values) {
|
|
14
|
+
if (out.length < values.length)
|
|
15
|
+
throw new RangeError('Result buffer is too short');
|
|
16
|
+
const copy = Array.from(values);
|
|
17
|
+
for (let i = 0; i < copy.length; i++)
|
|
18
|
+
out[i] = copy[i];
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
function direction(d) {
|
|
22
|
+
check(d);
|
|
23
|
+
if (Math.hypot(d[0], d[1], d[2]) === 0)
|
|
24
|
+
throw new RangeError('Ray direction must be nonzero');
|
|
25
|
+
}
|
|
26
|
+
export function getRayPoint(origin, dir, t, out = [0, 0, 0]) {
|
|
27
|
+
check(origin);
|
|
28
|
+
direction(dir);
|
|
29
|
+
if (!Number.isFinite(t) || t < 0)
|
|
30
|
+
throw new RangeError('Ray parameter must be finite and nonnegative');
|
|
31
|
+
return output(out, [origin[0] + t * dir[0], origin[1] + t * dir[1], origin[2] + t * dir[2]]);
|
|
32
|
+
}
|
|
33
|
+
export function getClosestPointOnRay(point, origin, dir, out = [0, 0, 0]) {
|
|
34
|
+
check(point, origin);
|
|
35
|
+
direction(dir);
|
|
36
|
+
const unit = normalizeQueryDirection(dir, 3);
|
|
37
|
+
const distance = Math.max(0, dot(sub(point, origin), unit));
|
|
38
|
+
return output(out, [0, 1, 2].map(i => origin[i] + distance * unit[i]));
|
|
39
|
+
}
|
|
40
|
+
export function distanceToRay(point, origin, dir) {
|
|
41
|
+
const p = getClosestPointOnRay(point, origin, dir);
|
|
42
|
+
return Math.hypot(...sub(point, p));
|
|
43
|
+
}
|
|
44
|
+
export function getClosestPointsRaySegment(origin, dir, a, b) {
|
|
45
|
+
check(origin, a, b);
|
|
46
|
+
direction(dir);
|
|
47
|
+
const unit = normalizeQueryDirection(dir, 3);
|
|
48
|
+
const directionLength = Math.hypot(dir[0], dir[1], dir[2]);
|
|
49
|
+
const edge = sub(b, a), offset = sub(origin, a);
|
|
50
|
+
const segmentLength = Math.hypot(...edge);
|
|
51
|
+
const segmentUnit = edge.map(x => (segmentLength ? x / segmentLength : 0));
|
|
52
|
+
const bb = dot(unit, segmentUnit), dd = dot(unit, offset), ee = dot(segmentUnit, offset);
|
|
53
|
+
const candidates = [
|
|
54
|
+
[0, Math.max(0, Math.min(segmentLength, ee))],
|
|
55
|
+
[Math.max(0, -dd), 0],
|
|
56
|
+
[Math.max(0, bb * segmentLength - dd), segmentLength]
|
|
57
|
+
];
|
|
58
|
+
// Cross products retain the angle when nearly parallel dot products round to one.
|
|
59
|
+
const normal = cross(unit, segmentUnit);
|
|
60
|
+
const sine = Math.hypot(...normal);
|
|
61
|
+
if (segmentLength > 0 && sine > 0) {
|
|
62
|
+
const normalUnit = normal.map(value => value / sine);
|
|
63
|
+
const separation = sub(a, origin);
|
|
64
|
+
const t = dot(cross(separation, segmentUnit), normalUnit) / sine;
|
|
65
|
+
const u = dot(cross(separation, unit), normalUnit) / sine;
|
|
66
|
+
if (t >= 0 && u >= 0 && u <= segmentLength)
|
|
67
|
+
candidates.push([t, u]);
|
|
68
|
+
}
|
|
69
|
+
let best;
|
|
70
|
+
for (const [t, u] of candidates) {
|
|
71
|
+
const rayPoint = [
|
|
72
|
+
origin[0] + t * unit[0],
|
|
73
|
+
origin[1] + t * unit[1],
|
|
74
|
+
origin[2] + t * unit[2]
|
|
75
|
+
];
|
|
76
|
+
const segmentPoint = [
|
|
77
|
+
a[0] + u * segmentUnit[0],
|
|
78
|
+
a[1] + u * segmentUnit[1],
|
|
79
|
+
a[2] + u * segmentUnit[2]
|
|
80
|
+
];
|
|
81
|
+
const distance = Math.hypot(...sub(rayPoint, segmentPoint));
|
|
82
|
+
if (!best || distance < best.distance)
|
|
83
|
+
best = {
|
|
84
|
+
rayPoint,
|
|
85
|
+
segmentPoint,
|
|
86
|
+
rayParameter: t / directionLength,
|
|
87
|
+
segmentFraction: segmentLength ? u / segmentLength : 0,
|
|
88
|
+
distance
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return best;
|
|
92
|
+
}
|
|
93
|
+
/** Finite affine transforms only. The unnormalized output direction preserves the ray parameter. */
|
|
94
|
+
export function transformRay(origin, dir, matrix) {
|
|
95
|
+
check(origin);
|
|
96
|
+
direction(dir);
|
|
97
|
+
if (matrix.length !== 16 ||
|
|
98
|
+
Array.from(matrix).some(x => !Number.isFinite(x)) ||
|
|
99
|
+
matrix[3] !== 0 ||
|
|
100
|
+
matrix[7] !== 0 ||
|
|
101
|
+
matrix[11] !== 0 ||
|
|
102
|
+
matrix[15] !== 1)
|
|
103
|
+
throw new RangeError('Expected a finite affine matrix');
|
|
104
|
+
const apply = (p, w) => [0, 1, 2].map(i => matrix[i] * p[0] + matrix[i + 4] * p[1] + matrix[i + 8] * p[2] + w * matrix[i + 12]);
|
|
105
|
+
const transformed = { origin: apply(origin, 1), direction: apply(dir, 0) };
|
|
106
|
+
check(transformed.origin);
|
|
107
|
+
direction(transformed.direction);
|
|
108
|
+
return transformed;
|
|
109
|
+
}
|
|
110
|
+
function triangle(a, b, c) {
|
|
111
|
+
check(a, b, c);
|
|
112
|
+
const ab = sub(b, a), ac = sub(c, a);
|
|
113
|
+
const scale = Math.max(Math.hypot(...ab), Math.hypot(...ac));
|
|
114
|
+
const u = ab.map(x => (scale ? x / scale : 0)), v = ac.map(x => (scale ? x / scale : 0));
|
|
115
|
+
return { u, v, scale, normal: cross(u, v) };
|
|
116
|
+
}
|
|
117
|
+
/** Barycentrics of the point's orthogonal projection; null for a degenerate triangle. */
|
|
118
|
+
export function getTriangleBarycentric(point, a, b, c, out = [0, 0, 0]) {
|
|
119
|
+
check(point);
|
|
120
|
+
const { u, v, scale, normal } = triangle(a, b, c), denominator = dot(normal, normal);
|
|
121
|
+
if (denominator === 0)
|
|
122
|
+
return null;
|
|
123
|
+
const p = sub(point, a).map(x => x / scale);
|
|
124
|
+
const second = dot(cross(p, v), normal) / denominator;
|
|
125
|
+
const third = dot(cross(u, p), normal) / denominator;
|
|
126
|
+
return output(out, [1 - second - third, second, third]);
|
|
127
|
+
}
|
|
128
|
+
export function getTriangleArea(a, b, c) {
|
|
129
|
+
const { normal, scale } = triangle(a, b, c);
|
|
130
|
+
return (Math.hypot(...normal) * scale * scale) / 2;
|
|
131
|
+
}
|
|
132
|
+
export function getTriangleNormal(a, b, c, out = [0, 0, 0]) {
|
|
133
|
+
const { normal } = triangle(a, b, c), length = Math.hypot(...normal);
|
|
134
|
+
return output(out, normal.map(x => (length ? x / length : 0)));
|
|
135
|
+
}
|
|
136
|
+
/** Front-facing means the oriented normal points against the viewing/ray direction. */
|
|
137
|
+
export function isTriangleFrontFacing(a, b, c, dir) {
|
|
138
|
+
direction(dir);
|
|
139
|
+
return dot(triangle(a, b, c).normal, dir) < 0;
|
|
140
|
+
}
|
|
141
|
+
/** Relative tolerance: plane distance is scaled by the longest edge from a. */
|
|
142
|
+
export function triangleContainsPoint(point, a, b, c, tolerance = 1e-10) {
|
|
143
|
+
if (!Number.isFinite(tolerance) || tolerance < 0)
|
|
144
|
+
throw new RangeError('Invalid tolerance');
|
|
145
|
+
const weights = getTriangleBarycentric(point, a, b, c);
|
|
146
|
+
if (!weights)
|
|
147
|
+
return false;
|
|
148
|
+
const { normal, scale } = triangle(a, b, c);
|
|
149
|
+
const distance = Math.abs(dot(sub(point, a).map(x => x / scale), normal)) / Math.hypot(...normal);
|
|
150
|
+
return (distance <= tolerance && Array.from(weights).every(x => x >= -tolerance && x <= 1 + tolerance));
|
|
151
|
+
}
|
|
152
|
+
export function interpolateTriangleAttribute(weights, a, b, c, out = new Array(a.length)) {
|
|
153
|
+
check(weights);
|
|
154
|
+
if (!a.length ||
|
|
155
|
+
a.length !== b.length ||
|
|
156
|
+
a.length !== c.length ||
|
|
157
|
+
[a, b, c].some(p => Array.from(p).some(x => !Number.isFinite(x))))
|
|
158
|
+
throw new RangeError('Expected matching finite attributes');
|
|
159
|
+
return output(out, Array.from(a, (x, i) => weights[0] * x + weights[1] * b[i] + weights[2] * c[i]));
|
|
160
|
+
}
|
|
161
|
+
/** Closed segment; a coplanar segment returns its start, a disjoint segment returns null. */
|
|
162
|
+
export function intersectPlaneSegment(normal, constant, start, end, out = [0, 0, 0]) {
|
|
163
|
+
check(start, end);
|
|
164
|
+
direction(normal);
|
|
165
|
+
if (!Number.isFinite(constant))
|
|
166
|
+
throw new RangeError('Plane constant must be finite');
|
|
167
|
+
const a = dot(normal, start) + constant, b = dot(normal, end) + constant;
|
|
168
|
+
if (a === 0)
|
|
169
|
+
return output(out, start);
|
|
170
|
+
if (b === 0)
|
|
171
|
+
return output(out, end);
|
|
172
|
+
if (a > 0 === b > 0)
|
|
173
|
+
return null;
|
|
174
|
+
const t = a / (a - b);
|
|
175
|
+
return output(out, [0, 1, 2].map(i => start[i] + t * (end[i] - start[i])));
|
|
176
|
+
}
|
|
177
|
+
/** Separating-axis test for a closed AABB. Degenerate triangles reduce to segments/points. */
|
|
178
|
+
export function triangleIntersectsBounds(a, b, c, minimum, maximum) {
|
|
179
|
+
check(a, b, c, minimum, maximum);
|
|
180
|
+
if ([0, 1, 2].some(i => minimum[i] > maximum[i]))
|
|
181
|
+
return false;
|
|
182
|
+
const center = [0, 1, 2].map(i => minimum[i] / 2 + maximum[i] / 2);
|
|
183
|
+
const extent = [0, 1, 2].map(i => maximum[i] / 2 - minimum[i] / 2);
|
|
184
|
+
const vertices = [a, b, c].map(p => sub(p, center));
|
|
185
|
+
const edges = [sub(b, a), sub(c, b), sub(a, c)];
|
|
186
|
+
const basis = [
|
|
187
|
+
[1, 0, 0],
|
|
188
|
+
[0, 1, 0],
|
|
189
|
+
[0, 0, 1]
|
|
190
|
+
];
|
|
191
|
+
const axes = [
|
|
192
|
+
...basis,
|
|
193
|
+
cross(edges[0], edges[1]),
|
|
194
|
+
...edges.flatMap(e => basis.map(axis => cross(e, axis)))
|
|
195
|
+
];
|
|
196
|
+
for (const axis of axes) {
|
|
197
|
+
const length = Math.hypot(...axis);
|
|
198
|
+
if (!length)
|
|
199
|
+
continue;
|
|
200
|
+
const unit = axis.map(x => x / length);
|
|
201
|
+
const projections = vertices.map(v => dot(v, unit));
|
|
202
|
+
const radius = extent.reduce((sum, x, i) => sum + x * Math.abs(unit[i]), 0);
|
|
203
|
+
if (Math.min(...projections) > radius || Math.max(...projections) < -radius)
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=geometric-queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometric-queries.js","sourceRoot":"","sources":["../../src/culling/geometric-queries.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,kBAAkB,EAAE,uBAAuB,EAAkB,qBAAkB;AAGvF,MAAM,GAAG,GAAG,CAAC,CAAa,EAAE,CAAa,EAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC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