@weasel-js/geom 1.12.0 → 1.13.0
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/dist/index.d.ts +40 -9
- package/dist/index.js +153 -29
- package/dist/index.js.map +1 -1
- package/dist/nd/index.d.ts +40 -1
- package/dist/nd/index.js +681 -1
- package/dist/nd/index.js.map +1 -1
- package/package.json +2 -2
package/dist/nd/index.d.ts
CHANGED
|
@@ -92,4 +92,43 @@ declare function resolveSnap<M>(problem: SnapProblem<M>): SnapResolution<M>;
|
|
|
92
92
|
*/
|
|
93
93
|
declare function stepLine(about: Vec, toward: Vec, basis: readonly [Vec, Vec], step: number): Flat;
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
/** Traversals over a `BvhTree`. Each takes its buffers from a `Scratch`,
|
|
96
|
+
* so a query allocates nothing unless a visit re-enters the tree. */
|
|
97
|
+
|
|
98
|
+
/** A half-space bounded by a plane: a point `x` is inside when
|
|
99
|
+
* `dot(normal, x) + offset >= 0`. */
|
|
100
|
+
interface HalfSpace {
|
|
101
|
+
normal: ArrayLike<number>;
|
|
102
|
+
offset: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Box layout: [min_0..min_{d-1}, max_0..max_{d-1}]. */
|
|
106
|
+
type BoxN = ArrayLike<number>;
|
|
107
|
+
/** A bounding volume hierarchy keyed by `K`, made by {@link createBvh}. */
|
|
108
|
+
interface Bvh<K> {
|
|
109
|
+
readonly dim: number;
|
|
110
|
+
readonly size: number;
|
|
111
|
+
/** False (and not stored) when any coordinate is non-finite or min > max.
|
|
112
|
+
* Inserting a key already present updates it. */
|
|
113
|
+
insert(key: K, box: BoxN): boolean;
|
|
114
|
+
/** False, keeping the old box, when the key is absent or the box invalid. */
|
|
115
|
+
update(key: K, box: BoxN): boolean;
|
|
116
|
+
remove(key: K): boolean;
|
|
117
|
+
/** Tighten every node box after updates that only moved items in place. */
|
|
118
|
+
refit(): void;
|
|
119
|
+
/** Rebuild the hierarchy top-down from the current boxes. */
|
|
120
|
+
rebuild(): void;
|
|
121
|
+
/** visit returns false to stop. In every query, changing the tree from inside
|
|
122
|
+
* a visit (insert, update, remove, refit, rebuild) is undefined. */
|
|
123
|
+
queryBox(box: BoxN, visit: (key: K) => boolean | void): void;
|
|
124
|
+
queryPoint(p: ArrayLike<number>, visit: (key: K) => boolean | void): void;
|
|
125
|
+
/** Leaves in nondecreasing order of box entry distance t (t >= 0, t <= tMax). */
|
|
126
|
+
raycast(origin: ArrayLike<number>, dir: ArrayLike<number>, visit: (key: K, t: number) => boolean | void, tMax?: number): void;
|
|
127
|
+
/** Leaves whose box is not wholly outside any half-space (conservative). */
|
|
128
|
+
queryHalfSpaces(planes: readonly HalfSpace[], visit: (key: K) => boolean | void): void;
|
|
129
|
+
}
|
|
130
|
+
/** A BVH over `dim`-dimensional boxes, built top-down from `entries` when
|
|
131
|
+
* given. Entries with an invalid box are skipped. */
|
|
132
|
+
declare function createBvh<K>(dim: number, entries?: Iterable<readonly [K, BoxN]>): Bvh<K>;
|
|
133
|
+
|
|
134
|
+
export { type BoxN, type Bvh, type Flat, type HalfSpace, type ProbeRole, type SnapCandidate, type SnapProbe, type SnapProblem, type SnapResolution, type SnapTier, type Vec, closestBetweenFlats, closestOnFlat, createBvh, flatDim, intersectFlats, resolveSnap, stepLine };
|