@flighthq/geometry 0.1.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/aabb.d.ts +88 -0
- package/dist/aabb.d.ts.map +1 -0
- package/dist/aabb.js +230 -0
- package/dist/aabb.js.map +1 -0
- package/dist/boundingSphere.d.ts +62 -0
- package/dist/boundingSphere.d.ts.map +1 -0
- package/dist/boundingSphere.js +188 -0
- package/dist/boundingSphere.js.map +1 -0
- package/dist/capsule.d.ts +38 -0
- package/dist/capsule.d.ts.map +1 -0
- package/dist/capsule.js +215 -0
- package/dist/capsule.js.map +1 -0
- package/dist/frustum.d.ts +49 -0
- package/dist/frustum.d.ts.map +1 -0
- package/dist/frustum.js +149 -0
- package/dist/frustum.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/matrix.d.ts +152 -0
- package/dist/matrix.d.ts.map +1 -0
- package/dist/matrix.js +488 -0
- package/dist/matrix.js.map +1 -0
- package/dist/matrix3.d.ts +63 -0
- package/dist/matrix3.d.ts.map +1 -0
- package/dist/matrix3.js +408 -0
- package/dist/matrix3.js.map +1 -0
- package/dist/matrix3Pool.d.ts +6 -0
- package/dist/matrix3Pool.d.ts.map +1 -0
- package/dist/matrix3Pool.js +26 -0
- package/dist/matrix3Pool.js.map +1 -0
- package/dist/matrix4.d.ts +238 -0
- package/dist/matrix4.d.ts.map +1 -0
- package/dist/matrix4.js +931 -0
- package/dist/matrix4.js.map +1 -0
- package/dist/matrix4Pool.d.ts +6 -0
- package/dist/matrix4Pool.d.ts.map +1 -0
- package/dist/matrix4Pool.js +26 -0
- package/dist/matrix4Pool.js.map +1 -0
- package/dist/matrixPool.d.ts +6 -0
- package/dist/matrixPool.d.ts.map +1 -0
- package/dist/matrixPool.js +26 -0
- package/dist/matrixPool.js.map +1 -0
- package/dist/obb.d.ts +44 -0
- package/dist/obb.d.ts.map +1 -0
- package/dist/obb.js +248 -0
- package/dist/obb.js.map +1 -0
- package/dist/plane.d.ts +66 -0
- package/dist/plane.d.ts.map +1 -0
- package/dist/plane.js +140 -0
- package/dist/plane.js.map +1 -0
- package/dist/quaternion.d.ts +128 -0
- package/dist/quaternion.d.ts.map +1 -0
- package/dist/quaternion.js +508 -0
- package/dist/quaternion.js.map +1 -0
- package/dist/quaternionPool.d.ts +6 -0
- package/dist/quaternionPool.d.ts.map +1 -0
- package/dist/quaternionPool.js +29 -0
- package/dist/quaternionPool.js.map +1 -0
- package/dist/ray3d.d.ts +69 -0
- package/dist/ray3d.d.ts.map +1 -0
- package/dist/ray3d.js +264 -0
- package/dist/ray3d.js.map +1 -0
- package/dist/rectangle.d.ts +56 -0
- package/dist/rectangle.d.ts.map +1 -0
- package/dist/rectangle.js +235 -0
- package/dist/rectangle.js.map +1 -0
- package/dist/rectanglePool.d.ts +6 -0
- package/dist/rectanglePool.d.ts.map +1 -0
- package/dist/rectanglePool.js +29 -0
- package/dist/rectanglePool.js.map +1 -0
- package/dist/typedarray.d.ts +4 -0
- package/dist/typedarray.d.ts.map +1 -0
- package/dist/typedarray.js +25 -0
- package/dist/typedarray.js.map +1 -0
- package/dist/vector2.d.ts +130 -0
- package/dist/vector2.d.ts.map +1 -0
- package/dist/vector2.js +250 -0
- package/dist/vector2.js.map +1 -0
- package/dist/vector2Pool.d.ts +6 -0
- package/dist/vector2Pool.d.ts.map +1 -0
- package/dist/vector2Pool.js +20 -0
- package/dist/vector2Pool.js.map +1 -0
- package/dist/vector3.d.ts +220 -0
- package/dist/vector3.d.ts.map +1 -0
- package/dist/vector3.js +380 -0
- package/dist/vector3.js.map +1 -0
- package/dist/vector3Pool.d.ts +6 -0
- package/dist/vector3Pool.d.ts.map +1 -0
- package/dist/vector3Pool.js +28 -0
- package/dist/vector3Pool.js.map +1 -0
- package/dist/vector4.d.ts +180 -0
- package/dist/vector4.d.ts.map +1 -0
- package/dist/vector4.js +333 -0
- package/dist/vector4.js.map +1 -0
- package/dist/vector4Pool.d.ts +6 -0
- package/dist/vector4Pool.d.ts.map +1 -0
- package/dist/vector4Pool.js +29 -0
- package/dist/vector4Pool.js.map +1 -0
- package/package.json +38 -0
- package/src/aabb.test.ts +341 -0
- package/src/boundingSphere.test.ts +247 -0
- package/src/capsule.test.ts +157 -0
- package/src/frustum.test.ts +160 -0
- package/src/matrix.test.ts +1111 -0
- package/src/matrix3.test.ts +752 -0
- package/src/matrix3Pool.test.ts +73 -0
- package/src/matrix4.test.ts +1627 -0
- package/src/matrix4Pool.test.ts +71 -0
- package/src/matrixPool.test.ts +69 -0
- package/src/obb.test.ts +183 -0
- package/src/plane.test.ts +225 -0
- package/src/quaternion.test.ts +531 -0
- package/src/quaternionPool.test.ts +64 -0
- package/src/ray3d.test.ts +297 -0
- package/src/rectangle.test.ts +982 -0
- package/src/rectanglePool.test.ts +71 -0
- package/src/typedarray.test.ts +118 -0
- package/src/vector2.test.ts +958 -0
- package/src/vector2Pool.test.ts +65 -0
- package/src/vector3.test.ts +749 -0
- package/src/vector3Pool.test.ts +68 -0
- package/src/vector4.test.ts +660 -0
- package/src/vector4Pool.test.ts +71 -0
package/dist/ray3d.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { createEntity } from '@flighthq/entity';
|
|
2
|
+
import { createVector3 } from './vector3';
|
|
3
|
+
// Creates a Ray3D with an explicit origin and normalized direction. Both vectors are allocated
|
|
4
|
+
// fresh. With no arguments the ray sits at the origin pointing in +Z.
|
|
5
|
+
export function createRay3D(originX, originY, originZ, directionX, directionY, directionZ) {
|
|
6
|
+
return createEntity({
|
|
7
|
+
direction: createVector3(directionX ?? 0, directionY ?? 0, directionZ ?? 1),
|
|
8
|
+
origin: createVector3(originX ?? 0, originY ?? 0, originZ ?? 0),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Writes the closest pair of points between two rays: `outA` receives the point on ray `a`
|
|
13
|
+
* closest to ray `b`, and `outB` the point on ray `b` closest to ray `a`. Both parameters are
|
|
14
|
+
* clamped to `t >= 0` so the result respects ray (half-line) semantics rather than infinite
|
|
15
|
+
* lines. Parallel rays fall back to projecting `b`'s origin onto ray `a`.
|
|
16
|
+
*
|
|
17
|
+
* Directions need not be normalized. Reads all inputs into locals before writing, so it is safe
|
|
18
|
+
* when `outA`/`outB` alias the ray vectors.
|
|
19
|
+
*/
|
|
20
|
+
export function getClosestPointBetweenRay3Ds(outA, outB, a, b) {
|
|
21
|
+
const aox = a.origin.x, aoy = a.origin.y, aoz = a.origin.z;
|
|
22
|
+
const adx = a.direction.x, ady = a.direction.y, adz = a.direction.z;
|
|
23
|
+
const box = b.origin.x, boy = b.origin.y, boz = b.origin.z;
|
|
24
|
+
const bdx = b.direction.x, bdy = b.direction.y, bdz = b.direction.z;
|
|
25
|
+
// Standard line-line closest-point parameters (Ericson, Real-Time Collision Detection):
|
|
26
|
+
// r = aOrigin - bOrigin, then solve the 2×2 system.
|
|
27
|
+
const aa = adx * adx + ady * ady + adz * adz; // |dirA|^2
|
|
28
|
+
const bb = bdx * bdx + bdy * bdy + bdz * bdz; // |dirB|^2
|
|
29
|
+
const ab = adx * bdx + ady * bdy + adz * bdz; // dirA · dirB
|
|
30
|
+
const rx = aox - box, ry = aoy - boy, rz = aoz - boz;
|
|
31
|
+
const ar = adx * rx + ady * ry + adz * rz; // dirA · r
|
|
32
|
+
const br = bdx * rx + bdy * ry + bdz * rz; // dirB · r
|
|
33
|
+
const denom = aa * bb - ab * ab;
|
|
34
|
+
let ta;
|
|
35
|
+
let tb;
|
|
36
|
+
if (denom !== 0) {
|
|
37
|
+
ta = (ab * br - bb * ar) / denom;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Parallel: anchor on ray a's origin.
|
|
41
|
+
ta = 0;
|
|
42
|
+
}
|
|
43
|
+
if (ta < 0)
|
|
44
|
+
ta = 0;
|
|
45
|
+
// Recompute tb from the chosen ta, then clamp and re-derive ta if tb was clamped.
|
|
46
|
+
tb = bb !== 0 ? (ab * ta + br) / bb : 0;
|
|
47
|
+
if (tb < 0) {
|
|
48
|
+
tb = 0;
|
|
49
|
+
ta = aa !== 0 ? -ar / aa : 0;
|
|
50
|
+
if (ta < 0)
|
|
51
|
+
ta = 0;
|
|
52
|
+
}
|
|
53
|
+
outA.x = aox + adx * ta;
|
|
54
|
+
outA.y = aoy + ady * ta;
|
|
55
|
+
outA.z = aoz + adz * ta;
|
|
56
|
+
outB.x = box + bdx * tb;
|
|
57
|
+
outB.y = boy + bdy * tb;
|
|
58
|
+
outB.z = boz + bdz * tb;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Writes the point on a ray closest to `point`: `point` projected onto the ray and clamped to
|
|
62
|
+
* `t >= 0` so it stays in front of the origin. When `point` projects behind the origin the ray
|
|
63
|
+
* origin is written. Direction need not be normalized.
|
|
64
|
+
*
|
|
65
|
+
* Reads all inputs into locals before writing, so it is safe when `out` aliases `point` or a
|
|
66
|
+
* ray vector.
|
|
67
|
+
*/
|
|
68
|
+
export function getClosestPointOnRay3D(out, ray, point) {
|
|
69
|
+
const ox = ray.origin.x, oy = ray.origin.y, oz = ray.origin.z;
|
|
70
|
+
const dx = ray.direction.x, dy = ray.direction.y, dz = ray.direction.z;
|
|
71
|
+
const px = point.x, py = point.y, pz = point.z;
|
|
72
|
+
const lenSq = dx * dx + dy * dy + dz * dz;
|
|
73
|
+
let t = lenSq !== 0 ? ((px - ox) * dx + (py - oy) * dy + (pz - oz) * dz) / lenSq : 0;
|
|
74
|
+
if (t < 0)
|
|
75
|
+
t = 0;
|
|
76
|
+
out.x = ox + dx * t;
|
|
77
|
+
out.y = oy + dy * t;
|
|
78
|
+
out.z = oz + dz * t;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns the point on a ray at parameter `t`: `origin + t * direction`. Writes the result to
|
|
82
|
+
* `out`. `t` should be >= 0 for points in front of the origin. There is no bounds check on `t`.
|
|
83
|
+
*
|
|
84
|
+
* Safe when `out` aliases `ray.origin` or `ray.direction`.
|
|
85
|
+
*/
|
|
86
|
+
export function getRay3DPointAt(out, ray, t) {
|
|
87
|
+
const ox = ray.origin.x, oy = ray.origin.y, oz = ray.origin.z;
|
|
88
|
+
const dx = ray.direction.x, dy = ray.direction.y, dz = ray.direction.z;
|
|
89
|
+
out.x = ox + dx * t;
|
|
90
|
+
out.y = oy + dy * t;
|
|
91
|
+
out.z = oz + dz * t;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Tests whether a ray intersects an axis-aligned bounding box (slab method).
|
|
95
|
+
*
|
|
96
|
+
* Returns the entry parameter `t` (>= 0) on hit, or `-1` on miss. A ray that starts inside the
|
|
97
|
+
* box returns `t = 0`. Direction components need not be normalized; the test works for any
|
|
98
|
+
* non-zero direction. A zero-component direction is handled (the ray is parallel to that slab
|
|
99
|
+
* and outside returns -1, inside continues).
|
|
100
|
+
*/
|
|
101
|
+
export function intersectRay3DAabb(ray, aabb) {
|
|
102
|
+
const ox = ray.origin.x, oy = ray.origin.y, oz = ray.origin.z;
|
|
103
|
+
const dx = ray.direction.x, dy = ray.direction.y, dz = ray.direction.z;
|
|
104
|
+
let tMin = 0;
|
|
105
|
+
let tMax = Number.POSITIVE_INFINITY;
|
|
106
|
+
// X slab
|
|
107
|
+
if (dx !== 0) {
|
|
108
|
+
const invDx = 1 / dx;
|
|
109
|
+
let t1 = (aabb.min.x - ox) * invDx;
|
|
110
|
+
let t2 = (aabb.max.x - ox) * invDx;
|
|
111
|
+
if (t1 > t2) {
|
|
112
|
+
const tmp = t1;
|
|
113
|
+
t1 = t2;
|
|
114
|
+
t2 = tmp;
|
|
115
|
+
}
|
|
116
|
+
tMin = Math.max(tMin, t1);
|
|
117
|
+
tMax = Math.min(tMax, t2);
|
|
118
|
+
if (tMin > tMax)
|
|
119
|
+
return -1;
|
|
120
|
+
}
|
|
121
|
+
else if (ox < aabb.min.x || ox > aabb.max.x) {
|
|
122
|
+
return -1;
|
|
123
|
+
}
|
|
124
|
+
// Y slab
|
|
125
|
+
if (dy !== 0) {
|
|
126
|
+
const invDy = 1 / dy;
|
|
127
|
+
let t1 = (aabb.min.y - oy) * invDy;
|
|
128
|
+
let t2 = (aabb.max.y - oy) * invDy;
|
|
129
|
+
if (t1 > t2) {
|
|
130
|
+
const tmp = t1;
|
|
131
|
+
t1 = t2;
|
|
132
|
+
t2 = tmp;
|
|
133
|
+
}
|
|
134
|
+
tMin = Math.max(tMin, t1);
|
|
135
|
+
tMax = Math.min(tMax, t2);
|
|
136
|
+
if (tMin > tMax)
|
|
137
|
+
return -1;
|
|
138
|
+
}
|
|
139
|
+
else if (oy < aabb.min.y || oy > aabb.max.y) {
|
|
140
|
+
return -1;
|
|
141
|
+
}
|
|
142
|
+
// Z slab
|
|
143
|
+
if (dz !== 0) {
|
|
144
|
+
const invDz = 1 / dz;
|
|
145
|
+
let t1 = (aabb.min.z - oz) * invDz;
|
|
146
|
+
let t2 = (aabb.max.z - oz) * invDz;
|
|
147
|
+
if (t1 > t2) {
|
|
148
|
+
const tmp = t1;
|
|
149
|
+
t1 = t2;
|
|
150
|
+
t2 = tmp;
|
|
151
|
+
}
|
|
152
|
+
tMin = Math.max(tMin, t1);
|
|
153
|
+
tMax = Math.min(tMax, t2);
|
|
154
|
+
if (tMin > tMax)
|
|
155
|
+
return -1;
|
|
156
|
+
}
|
|
157
|
+
else if (oz < aabb.min.z || oz > aabb.max.z) {
|
|
158
|
+
return -1;
|
|
159
|
+
}
|
|
160
|
+
return tMin;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Tests whether a ray intersects a plane.
|
|
164
|
+
*
|
|
165
|
+
* Returns the parameter `t` (>= 0) such that `origin + t * direction` lies on the plane, or
|
|
166
|
+
* `-1` if the ray is parallel to the plane (no intersection) or intersects behind the origin.
|
|
167
|
+
* The plane is given in the form `ax + by + cz + d = 0` with a (not necessarily unit) normal.
|
|
168
|
+
*
|
|
169
|
+
* Direction need not be normalized; `t` is in the same units as `direction`.
|
|
170
|
+
*/
|
|
171
|
+
export function intersectRay3DPlane(ray, plane) {
|
|
172
|
+
const denom = plane.a * ray.direction.x + plane.b * ray.direction.y + plane.c * ray.direction.z;
|
|
173
|
+
if (Math.abs(denom) < 1e-10)
|
|
174
|
+
return -1; // parallel
|
|
175
|
+
const t = -(plane.a * ray.origin.x + plane.b * ray.origin.y + plane.c * ray.origin.z + plane.d) / denom;
|
|
176
|
+
return t >= 0 ? t : -1;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Tests whether a ray intersects a bounding sphere.
|
|
180
|
+
*
|
|
181
|
+
* Returns the parameter `t` of the nearer intersection (>= 0), or `-1` on miss. An empty
|
|
182
|
+
* sphere (radius < 0) always returns `-1`. A ray that starts inside the sphere returns `t = 0`
|
|
183
|
+
* at the entry point (the near intersection is behind the origin; we clamp to `0`).
|
|
184
|
+
*
|
|
185
|
+
* Direction need not be normalized; `t` is in direction units.
|
|
186
|
+
*/
|
|
187
|
+
export function intersectRay3DSphere(ray, sphere) {
|
|
188
|
+
if (sphere.radius < 0)
|
|
189
|
+
return -1;
|
|
190
|
+
const ox = ray.origin.x - sphere.center.x;
|
|
191
|
+
const oy = ray.origin.y - sphere.center.y;
|
|
192
|
+
const oz = ray.origin.z - sphere.center.z;
|
|
193
|
+
const dx = ray.direction.x, dy = ray.direction.y, dz = ray.direction.z;
|
|
194
|
+
// Quadratic: |d|^2 t^2 + 2(o·d) t + (|o|^2 - r^2) = 0
|
|
195
|
+
const a = dx * dx + dy * dy + dz * dz;
|
|
196
|
+
if (a === 0)
|
|
197
|
+
return -1; // zero-length direction
|
|
198
|
+
const b = ox * dx + oy * dy + oz * dz;
|
|
199
|
+
const c = ox * ox + oy * oy + oz * oz - sphere.radius * sphere.radius;
|
|
200
|
+
const disc = b * b - a * c;
|
|
201
|
+
if (disc < 0)
|
|
202
|
+
return -1;
|
|
203
|
+
const sqrtDisc = Math.sqrt(disc);
|
|
204
|
+
const t = (-b - sqrtDisc) / a;
|
|
205
|
+
if (t >= 0)
|
|
206
|
+
return t;
|
|
207
|
+
// Near intersection was behind origin; try far intersection
|
|
208
|
+
const t2 = (-b + sqrtDisc) / a;
|
|
209
|
+
return t2 >= 0 ? 0 : -1; // inside sphere: return t=0
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Tests whether a ray intersects a triangle using the Möller–Trumbore algorithm.
|
|
213
|
+
*
|
|
214
|
+
* Returns the parameter `t` (>= 0) such that `origin + t * direction` is the hit point, or
|
|
215
|
+
* `-1` on miss (back-face culling is off — both sides are tested). The direction need not be
|
|
216
|
+
* normalized; `t` is in direction units.
|
|
217
|
+
*
|
|
218
|
+
* Also returns `-1` for degenerate triangles (area ≈ 0).
|
|
219
|
+
*/
|
|
220
|
+
export function intersectRay3DTriangle(ray, a, b, c) {
|
|
221
|
+
// Edge vectors
|
|
222
|
+
const e1x = b.x - a.x, e1y = b.y - a.y, e1z = b.z - a.z;
|
|
223
|
+
const e2x = c.x - a.x, e2y = c.y - a.y, e2z = c.z - a.z;
|
|
224
|
+
const dx = ray.direction.x, dy = ray.direction.y, dz = ray.direction.z;
|
|
225
|
+
// h = direction × e2
|
|
226
|
+
const hx = dy * e2z - dz * e2y;
|
|
227
|
+
const hy = dz * e2x - dx * e2z;
|
|
228
|
+
const hz = dx * e2y - dy * e2x;
|
|
229
|
+
const det = e1x * hx + e1y * hy + e1z * hz;
|
|
230
|
+
if (Math.abs(det) < 1e-10)
|
|
231
|
+
return -1; // parallel or degenerate
|
|
232
|
+
const invDet = 1 / det;
|
|
233
|
+
// s = origin - a
|
|
234
|
+
const sx = ray.origin.x - a.x, sy = ray.origin.y - a.y, sz = ray.origin.z - a.z;
|
|
235
|
+
// u = (s · h) * invDet
|
|
236
|
+
const u = (sx * hx + sy * hy + sz * hz) * invDet;
|
|
237
|
+
if (u < 0 || u > 1)
|
|
238
|
+
return -1;
|
|
239
|
+
// q = s × e1
|
|
240
|
+
const qx = sy * e1z - sz * e1y;
|
|
241
|
+
const qy = sz * e1x - sx * e1z;
|
|
242
|
+
const qz = sx * e1y - sy * e1x;
|
|
243
|
+
// v = (direction · q) * invDet
|
|
244
|
+
const v = (dx * qx + dy * qy + dz * qz) * invDet;
|
|
245
|
+
if (v < 0 || u + v > 1)
|
|
246
|
+
return -1;
|
|
247
|
+
// t = (e2 · q) * invDet
|
|
248
|
+
const t = (e2x * qx + e2y * qy + e2z * qz) * invDet;
|
|
249
|
+
return t >= 0 ? t : -1;
|
|
250
|
+
}
|
|
251
|
+
// Writes origin and direction into an existing Ray3D in place.
|
|
252
|
+
//
|
|
253
|
+
// Safe when `out` aliases an input vector (all inputs are read before writing).
|
|
254
|
+
export function setRay3D(out, origin, direction) {
|
|
255
|
+
const ox = origin.x, oy = origin.y, oz = origin.z;
|
|
256
|
+
const dx = direction.x, dy = direction.y, dz = direction.z;
|
|
257
|
+
out.origin.x = ox;
|
|
258
|
+
out.origin.y = oy;
|
|
259
|
+
out.origin.z = oz;
|
|
260
|
+
out.direction.x = dx;
|
|
261
|
+
out.direction.y = dy;
|
|
262
|
+
out.direction.z = dz;
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=ray3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ray3d.js","sourceRoot":"","sources":["../src/ray3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,+FAA+F;AAC/F,sEAAsE;AACtE,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,OAAgB,EAChB,OAAgB,EAChB,UAAmB,EACnB,UAAmB,EACnB,UAAmB;IAEnB,OAAO,YAAY,CAAC;QAClB,SAAS,EAAE,aAAa,CAAC,UAAU,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,CAAC;QAC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E,GAAG,SAAS,CAAC,CAAC,EAChB,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IACnB,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;IAClB,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;IAClB,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;IAClB,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;IACrB,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;IACrB,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Rectangle, RectangleLike, Vector2Like } from '@flighthq/types';
|
|
2
|
+
export declare function cloneRectangle(source: Readonly<RectangleLike>): Rectangle;
|
|
3
|
+
export declare function computeRectangleIntersection(out: RectangleLike, a: Readonly<RectangleLike>, b: Readonly<RectangleLike>): void;
|
|
4
|
+
export declare function containsRectanglePoint(source: Readonly<RectangleLike>, vector: Readonly<Vector2Like>): boolean;
|
|
5
|
+
export declare function containsRectanglePointXY(source: Readonly<RectangleLike>, x: number, y: number): boolean;
|
|
6
|
+
export declare function copyRectangle(out: RectangleLike, source: Readonly<RectangleLike>): void;
|
|
7
|
+
export declare function createRectangle(x?: number, y?: number, width?: number, height?: number): Rectangle;
|
|
8
|
+
export declare function enclosesRectangle(source: Readonly<RectangleLike>, other: Readonly<RectangleLike>): boolean;
|
|
9
|
+
export declare function equalsRectangle(a: Readonly<RectangleLike> | null | undefined, b: Readonly<RectangleLike> | null | undefined): boolean;
|
|
10
|
+
export declare function expandRectangleToPoint(out: RectangleLike, sourceRect: Readonly<RectangleLike>, sourceVec2: Readonly<Vector2Like>): void;
|
|
11
|
+
export declare function getRectangleBottom(source: Readonly<RectangleLike>): number;
|
|
12
|
+
/**
|
|
13
|
+
* Sets a Vector2Like object with bottom-right coordinates
|
|
14
|
+
*/
|
|
15
|
+
export declare function getRectangleBottomRight(out: Vector2Like, source: Readonly<RectangleLike>): void;
|
|
16
|
+
export declare function getRectangleLeft(source: Readonly<RectangleLike>): number;
|
|
17
|
+
export declare function getRectangleMaxX(source: Readonly<RectangleLike>): number;
|
|
18
|
+
export declare function getRectangleMaxY(source: Readonly<RectangleLike>): number;
|
|
19
|
+
export declare function getRectangleMinX(source: Readonly<RectangleLike>): number;
|
|
20
|
+
export declare function getRectangleMinY(source: Readonly<RectangleLike>): number;
|
|
21
|
+
export declare function getRectangleNormalizedBottomRight(out: Vector2Like, source: Readonly<RectangleLike>): void;
|
|
22
|
+
export declare function getRectangleNormalizedTopLeft(out: Vector2Like, source: Readonly<RectangleLike>): void;
|
|
23
|
+
export declare function getRectangleRight(source: Readonly<RectangleLike>): number;
|
|
24
|
+
/**
|
|
25
|
+
* Sets a Vector2Like object to width and height
|
|
26
|
+
*/
|
|
27
|
+
export declare function getRectangleSize(out: Vector2Like, source: Readonly<RectangleLike>): void;
|
|
28
|
+
export declare function getRectangleTop(source: Readonly<RectangleLike>): number;
|
|
29
|
+
/**
|
|
30
|
+
* Sets a Vector2Like object with top-left coordinates
|
|
31
|
+
*/
|
|
32
|
+
export declare function getRectangleTopLeft(out: Vector2Like, source: Readonly<RectangleLike>): void;
|
|
33
|
+
export declare function inflateRectangle(out: RectangleLike, source: Readonly<RectangleLike>, dx: number, dy: number): void;
|
|
34
|
+
export declare function intersectsRectangle(a: Readonly<RectangleLike>, b: Readonly<RectangleLike>): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if width or height is 0
|
|
37
|
+
*
|
|
38
|
+
* Note: Negative width or height is considered valid
|
|
39
|
+
*/
|
|
40
|
+
export declare function isEmptyRectangle(source: Readonly<RectangleLike>): boolean;
|
|
41
|
+
export declare function isFlippedXRectangle(source: Readonly<RectangleLike>): boolean;
|
|
42
|
+
export declare function isFlippedYRectangle(source: Readonly<RectangleLike>): boolean;
|
|
43
|
+
export declare function mergeRectangle(out: RectangleLike, source: Readonly<RectangleLike>, other: Readonly<RectangleLike>): void;
|
|
44
|
+
export declare function normalizeRectangle(out: RectangleLike, source: Readonly<RectangleLike>): void;
|
|
45
|
+
export declare function offsetRectangle(out: RectangleLike, source: Readonly<RectangleLike>, dx: number, dy: number): void;
|
|
46
|
+
export declare function offsetRectangleByPoint(out: RectangleLike, source: Readonly<RectangleLike>, point: Readonly<Vector2Like>): void;
|
|
47
|
+
export declare function setEmptyRectangle(out: RectangleLike): void;
|
|
48
|
+
export declare function setRectangle(out: RectangleLike, x: number, y: number, width: number, height: number): void;
|
|
49
|
+
export declare function setRectangleBottom(target: RectangleLike, value: number): void;
|
|
50
|
+
export declare function setRectangleBottomRight(target: RectangleLike, point: Readonly<Vector2Like>): void;
|
|
51
|
+
export declare function setRectangleLeft(target: RectangleLike, value: number): void;
|
|
52
|
+
export declare function setRectangleRight(target: RectangleLike, value: number): void;
|
|
53
|
+
export declare function setRectangleSize(out: RectangleLike, size: Readonly<Vector2Like>): void;
|
|
54
|
+
export declare function setRectangleTop(target: RectangleLike, value: number): void;
|
|
55
|
+
export declare function setRectangleTopLeft(out: RectangleLike, point: Readonly<Vector2Like>): void;
|
|
56
|
+
//# sourceMappingURL=rectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../src/rectangle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7E,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,SAAS,CAEzE;AAED,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,aAAa,EAClB,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,EAC1B,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,GACzB,IAAI,CAeN;AAED,wBAAgB,sBAAsB,CAAC,MAAM,E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AAW,CAAC,GAAG,IAAI,CAGjG;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG3E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAGtF;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG1E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAG1F"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { createEntity } from '@flighthq/entity';
|
|
2
|
+
export function cloneRectangle(source) {
|
|
3
|
+
return createRectangle(source.x, source.y, source.width, source.height);
|
|
4
|
+
}
|
|
5
|
+
export function computeRectangleIntersection(out, a, b) {
|
|
6
|
+
const x0 = Math.max(getRectangleMinX(a), getRectangleMinX(b));
|
|
7
|
+
const x1 = Math.min(getRectangleMaxX(a), getRectangleMaxX(b));
|
|
8
|
+
const y0 = Math.max(getRectangleMinY(a), getRectangleMinY(b));
|
|
9
|
+
const y1 = Math.min(getRectangleMaxY(a), getRectangleMaxY(b));
|
|
10
|
+
if (x1 <= x0 || y1 <= y0) {
|
|
11
|
+
setEmptyRectangle(out);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
out.x = x0;
|
|
15
|
+
out.y = y0;
|
|
16
|
+
out.width = x1 - x0;
|
|
17
|
+
out.height = y1 - y0;
|
|
18
|
+
}
|
|
19
|
+
export function containsRectanglePoint(source, vector) {
|
|
20
|
+
return containsRectanglePointXY(source, vector.x, vector.y);
|
|
21
|
+
}
|
|
22
|
+
export function containsRectanglePointXY(source, x, y) {
|
|
23
|
+
const x0 = Math.min(source.x, source.x + source.width);
|
|
24
|
+
const x1 = Math.max(source.x, source.x + source.width);
|
|
25
|
+
const y0 = Math.min(source.y, source.y + source.height);
|
|
26
|
+
const y1 = Math.max(source.y, source.y + source.height);
|
|
27
|
+
return x >= x0 && x < x1 && y >= y0 && y < y1;
|
|
28
|
+
}
|
|
29
|
+
export function copyRectangle(out, source) {
|
|
30
|
+
if (out !== source) {
|
|
31
|
+
out.x = source.x;
|
|
32
|
+
out.y = source.y;
|
|
33
|
+
out.width = source.width;
|
|
34
|
+
out.height = source.height;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function createRectangle(x, y, width, height) {
|
|
38
|
+
return createEntity({
|
|
39
|
+
x: x ?? 0,
|
|
40
|
+
y: y ?? 0,
|
|
41
|
+
width: width ?? 0,
|
|
42
|
+
height: height ?? 0,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function enclosesRectangle(source, other) {
|
|
46
|
+
const sx0 = Math.min(source.x, source.x + source.width);
|
|
47
|
+
const sx1 = Math.max(source.x, source.x + source.width);
|
|
48
|
+
const sy0 = Math.min(source.y, source.y + source.height);
|
|
49
|
+
const sy1 = Math.max(source.y, source.y + source.height);
|
|
50
|
+
const ox0 = Math.min(other.x, other.x + other.width);
|
|
51
|
+
const ox1 = Math.max(other.x, other.x + other.width);
|
|
52
|
+
const oy0 = Math.min(other.y, other.y + other.height);
|
|
53
|
+
const oy1 = Math.max(other.y, other.y + other.height);
|
|
54
|
+
// A rectangle contains another if all corners are inside (exclusive right/bottom)
|
|
55
|
+
return ox0 >= sx0 && oy0 >= sy0 && ox1 <= sx1 && oy1 <= sy1;
|
|
56
|
+
}
|
|
57
|
+
export function equalsRectangle(a, b) {
|
|
58
|
+
if (a === b)
|
|
59
|
+
return true;
|
|
60
|
+
if (!a || !b)
|
|
61
|
+
return false;
|
|
62
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
63
|
+
}
|
|
64
|
+
export function expandRectangleToPoint(out, sourceRect, sourceVec2) {
|
|
65
|
+
inflateRectangle(out, sourceRect, sourceVec2.x, sourceVec2.y);
|
|
66
|
+
}
|
|
67
|
+
export function getRectangleBottom(source) {
|
|
68
|
+
return source.y + source.height;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sets a Vector2Like object with bottom-right coordinates
|
|
72
|
+
*/
|
|
73
|
+
export function getRectangleBottomRight(out, source) {
|
|
74
|
+
out.x = source.x + source.width;
|
|
75
|
+
out.y = source.y + source.height;
|
|
76
|
+
}
|
|
77
|
+
export function getRectangleLeft(source) {
|
|
78
|
+
return source.x;
|
|
79
|
+
}
|
|
80
|
+
export function getRectangleMaxX(source) {
|
|
81
|
+
return Math.max(source.x, source.x + source.width);
|
|
82
|
+
}
|
|
83
|
+
export function getRectangleMaxY(source) {
|
|
84
|
+
return Math.max(source.y, source.y + source.height);
|
|
85
|
+
}
|
|
86
|
+
export function getRectangleMinX(source) {
|
|
87
|
+
return Math.min(source.x, source.x + source.width);
|
|
88
|
+
}
|
|
89
|
+
export function getRectangleMinY(source) {
|
|
90
|
+
return Math.min(source.y, source.y + source.height);
|
|
91
|
+
}
|
|
92
|
+
export function getRectangleNormalizedBottomRight(out, source) {
|
|
93
|
+
out.x = getRectangleMaxX(source);
|
|
94
|
+
out.y = getRectangleMaxY(source);
|
|
95
|
+
}
|
|
96
|
+
export function getRectangleNormalizedTopLeft(out, source) {
|
|
97
|
+
out.x = getRectangleMinX(source);
|
|
98
|
+
out.y = getRectangleMinY(source);
|
|
99
|
+
}
|
|
100
|
+
export function getRectangleRight(source) {
|
|
101
|
+
return source.x + source.width;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Sets a Vector2Like object to width and height
|
|
105
|
+
*/
|
|
106
|
+
export function getRectangleSize(out, source) {
|
|
107
|
+
out.x = source.width;
|
|
108
|
+
out.y = source.height;
|
|
109
|
+
}
|
|
110
|
+
export function getRectangleTop(source) {
|
|
111
|
+
return source.y;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Sets a Vector2Like object with top-left coordinates
|
|
115
|
+
*/
|
|
116
|
+
export function getRectangleTopLeft(out, source) {
|
|
117
|
+
out.x = source.x;
|
|
118
|
+
out.y = source.y;
|
|
119
|
+
}
|
|
120
|
+
export function inflateRectangle(out, source, dx, dy) {
|
|
121
|
+
out.x = source.x - dx;
|
|
122
|
+
out.width = source.width + dx * 2;
|
|
123
|
+
out.y = source.y - dy;
|
|
124
|
+
out.height = source.height + dy * 2;
|
|
125
|
+
}
|
|
126
|
+
export function intersectsRectangle(a, b) {
|
|
127
|
+
return !(getRectangleMaxX(a) <= getRectangleMinX(b) ||
|
|
128
|
+
getRectangleMinX(a) >= getRectangleMaxX(b) ||
|
|
129
|
+
getRectangleMaxY(a) <= getRectangleMinY(b) ||
|
|
130
|
+
getRectangleMinY(a) >= getRectangleMaxY(b));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Returns true if width or height is 0
|
|
134
|
+
*
|
|
135
|
+
* Note: Negative width or height is considered valid
|
|
136
|
+
*/
|
|
137
|
+
export function isEmptyRectangle(source) {
|
|
138
|
+
return source.width === 0 || source.height === 0;
|
|
139
|
+
}
|
|
140
|
+
export function isFlippedXRectangle(source) {
|
|
141
|
+
return source.width < 0;
|
|
142
|
+
}
|
|
143
|
+
export function isFlippedYRectangle(source) {
|
|
144
|
+
return source.height < 0;
|
|
145
|
+
}
|
|
146
|
+
export function mergeRectangle(out, source, other) {
|
|
147
|
+
const { x: sx, y: sy, width: sw, height: sh } = source;
|
|
148
|
+
const { x: ox, y: oy, width: ow, height: oh } = other;
|
|
149
|
+
const sEmpty = sw === 0 || sh === 0;
|
|
150
|
+
const oEmpty = ow === 0 || oh === 0;
|
|
151
|
+
if (sEmpty || oEmpty) {
|
|
152
|
+
if (oEmpty && source === out)
|
|
153
|
+
return;
|
|
154
|
+
out.x = oEmpty ? sx : ox;
|
|
155
|
+
out.y = oEmpty ? sy : oy;
|
|
156
|
+
out.width = oEmpty ? sw : ow;
|
|
157
|
+
out.height = oEmpty ? sh : oh;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const sourceLeft = Math.min(sx, sx + sw);
|
|
161
|
+
const sourceRight = Math.max(sx, sx + sw);
|
|
162
|
+
const sourceTop = Math.min(sy, sy + sh);
|
|
163
|
+
const sourceBottom = Math.max(sy, sy + sh);
|
|
164
|
+
const otherLeft = Math.min(ox, ox + ow);
|
|
165
|
+
const otherRight = Math.max(ox, ox + ow);
|
|
166
|
+
const otherTop = Math.min(oy, oy + oh);
|
|
167
|
+
const otherBottom = Math.max(oy, oy + oh);
|
|
168
|
+
let x0 = Math.min(sourceLeft, otherLeft);
|
|
169
|
+
const x1 = Math.max(sourceRight, otherRight);
|
|
170
|
+
const y0 = Math.min(sourceTop, otherTop);
|
|
171
|
+
const y1 = Math.max(sourceBottom, otherBottom);
|
|
172
|
+
out.x = x0;
|
|
173
|
+
out.y = y0;
|
|
174
|
+
out.width = x1 - x0;
|
|
175
|
+
out.height = y1 - y0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export function normalizeRectangle(out, source) {
|
|
179
|
+
const maxX = getRectangleMaxX(source);
|
|
180
|
+
const maxY = getRectangleMaxY(source);
|
|
181
|
+
const minX = getRectangleMinX(source);
|
|
182
|
+
const minY = getRectangleMinY(source);
|
|
183
|
+
out.x = minX;
|
|
184
|
+
out.y = minY;
|
|
185
|
+
out.width = maxX - minX;
|
|
186
|
+
out.height = maxY - minY;
|
|
187
|
+
}
|
|
188
|
+
export function offsetRectangle(out, source, dx, dy) {
|
|
189
|
+
out.x = source.x + dx;
|
|
190
|
+
out.y = source.y + dy;
|
|
191
|
+
out.width = source.width;
|
|
192
|
+
out.height = source.height;
|
|
193
|
+
}
|
|
194
|
+
export function offsetRectangleByPoint(out, source, point) {
|
|
195
|
+
out.x = source.x + point.x;
|
|
196
|
+
out.y = source.y + point.y;
|
|
197
|
+
out.width = source.width;
|
|
198
|
+
out.height = source.height;
|
|
199
|
+
}
|
|
200
|
+
export function setEmptyRectangle(out) {
|
|
201
|
+
out.x = out.y = out.width = out.height = 0;
|
|
202
|
+
}
|
|
203
|
+
export function setRectangle(out, x, y, width, height) {
|
|
204
|
+
out.x = x;
|
|
205
|
+
out.y = y;
|
|
206
|
+
out.width = width;
|
|
207
|
+
out.height = height;
|
|
208
|
+
}
|
|
209
|
+
export function setRectangleBottom(target, value) {
|
|
210
|
+
target.height = value - target.y;
|
|
211
|
+
}
|
|
212
|
+
export function setRectangleBottomRight(target, point) {
|
|
213
|
+
target.width = point.x - target.x;
|
|
214
|
+
target.height = point.y - target.y;
|
|
215
|
+
}
|
|
216
|
+
export function setRectangleLeft(target, value) {
|
|
217
|
+
target.width -= value - target.x;
|
|
218
|
+
target.x = value;
|
|
219
|
+
}
|
|
220
|
+
export function setRectangleRight(target, value) {
|
|
221
|
+
target.width = value - target.x;
|
|
222
|
+
}
|
|
223
|
+
export function setRectangleSize(out, size) {
|
|
224
|
+
out.width = size.x;
|
|
225
|
+
out.height = size.y;
|
|
226
|
+
}
|
|
227
|
+
export function setRectangleTop(target, value) {
|
|
228
|
+
target.height -= value - target.y;
|
|
229
|
+
target.y = value;
|
|
230
|
+
}
|
|
231
|
+
export function setRectangleTopLeft(out, point) {
|
|
232
|
+
out.x = point.x;
|
|
233
|
+
out.y = point.y;
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=rectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle.js","sourceRoot":"","sources":["../src/rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,MAA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le;
|
|
3
|
+
export declare function acquireRectangle(): Rectangle;
|
|
4
|
+
export declare function clearRectanglePool(): void;
|
|
5
|
+
export declare function releaseRectangle(r: Rectangle): void;
|
|
6
|
+
//# sourceMappingURL=rectanglePool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectanglePool.d.ts","sourceRoot":"","sources":["../src/rectanglePool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,wBAAgB,qBAAqB,IAAI,SAAS,CAOjD;AAED,wBAAgB,gBAAgB,IAAI,SAAS,CAU5C;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAGnD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRectangle } from './rectangle';
|
|
2
|
+
export function acquireEmptyRectangle() {
|
|
3
|
+
const r = acquireRectangle();
|
|
4
|
+
r.x = 0;
|
|
5
|
+
r.y = 0;
|
|
6
|
+
r.width = 0;
|
|
7
|
+
r.height = 0;
|
|
8
|
+
return r;
|
|
9
|
+
}
|
|
10
|
+
export function acquireRectangle() {
|
|
11
|
+
let r;
|
|
12
|
+
if (pool.length > 0) {
|
|
13
|
+
r = pool.pop();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
r = createRectangle();
|
|
17
|
+
}
|
|
18
|
+
return r;
|
|
19
|
+
}
|
|
20
|
+
export function clearRectanglePool() {
|
|
21
|
+
pool.length = 0;
|
|
22
|
+
}
|
|
23
|
+
export function releaseRectangle(r) {
|
|
24
|
+
if (!r)
|
|
25
|
+
return;
|
|
26
|
+
pool.push(r);
|
|
27
|
+
}
|
|
28
|
+
const pool = [];
|
|
29
|
+
//# sourceMappingURL=rectanglePool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectanglePool.js","sourceRoot":"","sources":["../src/rectanglePool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,UAAU,qBAAqB;IACnC,MAAM,CAAC,GAAG,gBAAgB,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACR,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACR,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IACZ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACb,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAY,CAAC;IAEjB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,CAAC,GAAG,IAAI,CAAC,GAAG,EAAe,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,CAAC,GAAG,eAAe,EAAE,CAAC;IACxB,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,CAAY;IAC3C,IAAI,CAAC,CAAC;QAAE,OAAO;IACf,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACf,CAAC;AAED,MAAM,IAAI,GAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function reserveFloat32Array(array: Float32Array, capacity: number): Float32Array;
|
|
2
|
+
export declare function reserveInt16Array(array: Int16Array, capacity: number): Int16Array;
|
|
3
|
+
export declare function reserveUint16Array(array: Uint16Array, capacity: number): Uint16Array;
|
|
4
|
+
//# sourceMappingURL=typedarray.d.ts.map
|