@aura3d/math 4.3.7 → 4.6.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/SphericalHarmonics3.d.ts +6 -3
- package/dist/SphericalHarmonics3.d.ts.map +1 -1
- package/dist/SphericalHarmonics3.js +8 -5
- package/dist/SphericalHarmonics3.js.map +1 -1
- package/dist/three/Box3.d.ts +106 -0
- package/dist/three/Box3.d.ts.map +1 -0
- package/dist/three/Box3.js +348 -0
- package/dist/three/Box3.js.map +1 -0
- package/dist/three/Color.d.ts +127 -0
- package/dist/three/Color.d.ts.map +1 -0
- package/dist/three/Color.js +501 -0
- package/dist/three/Color.js.map +1 -0
- package/dist/three/Euler.d.ts +50 -0
- package/dist/three/Euler.d.ts.map +1 -0
- package/dist/three/Euler.js +210 -0
- package/dist/three/Euler.js.map +1 -0
- package/dist/three/Frustum.d.ts +59 -0
- package/dist/three/Frustum.d.ts.map +1 -0
- package/dist/three/Frustum.js +135 -0
- package/dist/three/Frustum.js.map +1 -0
- package/dist/three/Matrix3.d.ts +56 -0
- package/dist/three/Matrix3.d.ts.map +1 -0
- package/dist/three/Matrix3.js +248 -0
- package/dist/three/Matrix3.js.map +1 -0
- package/dist/three/Matrix4.d.ts +79 -0
- package/dist/three/Matrix4.d.ts.map +1 -0
- package/dist/three/Matrix4.js +708 -0
- package/dist/three/Matrix4.js.map +1 -0
- package/dist/three/Plane.d.ts +65 -0
- package/dist/three/Plane.d.ts.map +1 -0
- package/dist/three/Plane.js +135 -0
- package/dist/three/Plane.js.map +1 -0
- package/dist/three/Quaternion.d.ts +91 -0
- package/dist/three/Quaternion.d.ts.map +1 -0
- package/dist/three/Quaternion.js +444 -0
- package/dist/three/Quaternion.js.map +1 -0
- package/dist/three/Ray.d.ts +56 -0
- package/dist/three/Ray.d.ts.map +1 -0
- package/dist/three/Ray.js +340 -0
- package/dist/three/Ray.js.map +1 -0
- package/dist/three/Sphere.d.ts +58 -0
- package/dist/three/Sphere.d.ts.map +1 -0
- package/dist/three/Sphere.js +166 -0
- package/dist/three/Sphere.js.map +1 -0
- package/dist/three/Triangle.d.ts +58 -0
- package/dist/three/Triangle.d.ts.map +1 -0
- package/dist/three/Triangle.js +229 -0
- package/dist/three/Triangle.js.map +1 -0
- package/dist/three/Vector2.d.ts +88 -0
- package/dist/three/Vector2.d.ts.map +1 -0
- package/dist/three/Vector2.js +283 -0
- package/dist/three/Vector2.js.map +1 -0
- package/dist/three/Vector3.d.ts +137 -0
- package/dist/three/Vector3.d.ts.map +1 -0
- package/dist/three/Vector3.js +458 -0
- package/dist/three/Vector3.js.map +1 -0
- package/dist/three/Vector4.d.ts +100 -0
- package/dist/three/Vector4.d.ts.map +1 -0
- package/dist/three/Vector4.js +443 -0
- package/dist/three/Vector4.js.map +1 -0
- package/dist/three/index.d.ts +29 -0
- package/dist/three/index.d.ts.map +1 -0
- package/dist/three/index.js +29 -0
- package/dist/three/index.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { Ray as ImmutableRay } from "../Ray.js";
|
|
2
|
+
import { Vector3 } from "./Vector3.js";
|
|
3
|
+
const _vector = new Vector3();
|
|
4
|
+
const _segCenter = new Vector3();
|
|
5
|
+
const _segDir = new Vector3();
|
|
6
|
+
const _diff = new Vector3();
|
|
7
|
+
const _edge1 = new Vector3();
|
|
8
|
+
const _edge2 = new Vector3();
|
|
9
|
+
const _normal = new Vector3();
|
|
10
|
+
/**
|
|
11
|
+
* Mutable three.js-compatible ray. Every modifier mutates `this` and returns
|
|
12
|
+
* `this`, exactly like three r185 `Ray`, including `null` for intersection
|
|
13
|
+
* misses (the immutable `@aura3d/math` Ray returns `undefined`).
|
|
14
|
+
*/
|
|
15
|
+
export class Ray {
|
|
16
|
+
origin;
|
|
17
|
+
direction;
|
|
18
|
+
constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) {
|
|
19
|
+
this.origin = origin;
|
|
20
|
+
this.direction = direction;
|
|
21
|
+
}
|
|
22
|
+
/** Copy an immutable `@aura3d/math` Ray (or any `{origin, direction}`) into this ray. */
|
|
23
|
+
fromImmutable(ray) {
|
|
24
|
+
this.origin.copy(ray.origin);
|
|
25
|
+
this.direction.copy(ray.direction);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
/** Snapshot as an immutable `@aura3d/math` Ray (normalizes the direction, throws on a zero direction). */
|
|
29
|
+
toImmutable() {
|
|
30
|
+
return new ImmutableRay(this.origin.toImmutable(), this.direction.toImmutable());
|
|
31
|
+
}
|
|
32
|
+
set(origin, direction) {
|
|
33
|
+
this.origin.copy(origin);
|
|
34
|
+
this.direction.copy(direction);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
copy(ray) {
|
|
38
|
+
this.origin.copy(ray.origin);
|
|
39
|
+
this.direction.copy(ray.direction);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
at(t, target) {
|
|
43
|
+
return target.copy(this.origin).addScaledVector(this.direction, t);
|
|
44
|
+
}
|
|
45
|
+
lookAt(v) {
|
|
46
|
+
this.direction.copy(v).sub(this.origin).normalize();
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
recast(t) {
|
|
50
|
+
this.origin.copy(this.at(t, _vector));
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
closestPointToPoint(point, target) {
|
|
54
|
+
target.subVectors(point, this.origin);
|
|
55
|
+
const directionDistance = target.dot(this.direction);
|
|
56
|
+
if (directionDistance < 0) {
|
|
57
|
+
return target.copy(this.origin);
|
|
58
|
+
}
|
|
59
|
+
return target.copy(this.origin).addScaledVector(this.direction, directionDistance);
|
|
60
|
+
}
|
|
61
|
+
distanceToPoint(point) {
|
|
62
|
+
return Math.sqrt(this.distanceSqToPoint(point));
|
|
63
|
+
}
|
|
64
|
+
distanceSqToPoint(point) {
|
|
65
|
+
const directionDistance = _vector.subVectors(point, this.origin).dot(this.direction);
|
|
66
|
+
// point behind the ray
|
|
67
|
+
if (directionDistance < 0) {
|
|
68
|
+
return this.origin.distanceToSquared(point);
|
|
69
|
+
}
|
|
70
|
+
_vector.copy(this.origin).addScaledVector(this.direction, directionDistance);
|
|
71
|
+
return _vector.distanceToSquared(point);
|
|
72
|
+
}
|
|
73
|
+
distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {
|
|
74
|
+
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h
|
|
75
|
+
// It returns the min distance between the ray and the segment
|
|
76
|
+
// defined by v0 and v1
|
|
77
|
+
// It can also set two optional targets :
|
|
78
|
+
// - The closest point on the ray
|
|
79
|
+
// - The closest point on the segment
|
|
80
|
+
_segCenter.copy(v0).add(v1).multiplyScalar(0.5);
|
|
81
|
+
_segDir.copy(v1).sub(v0).normalize();
|
|
82
|
+
_diff.copy(this.origin).sub(_segCenter);
|
|
83
|
+
const segExtent = v0.distanceTo(v1) * 0.5;
|
|
84
|
+
const a01 = -this.direction.dot(_segDir);
|
|
85
|
+
const b0 = _diff.dot(this.direction);
|
|
86
|
+
const b1 = -_diff.dot(_segDir);
|
|
87
|
+
const c = _diff.lengthSq();
|
|
88
|
+
const det = Math.abs(1 - a01 * a01);
|
|
89
|
+
let s0;
|
|
90
|
+
let s1;
|
|
91
|
+
let sqrDist;
|
|
92
|
+
let extDet;
|
|
93
|
+
if (det > 0) {
|
|
94
|
+
// The ray and segment are not parallel.
|
|
95
|
+
s0 = a01 * b1 - b0;
|
|
96
|
+
s1 = a01 * b0 - b1;
|
|
97
|
+
extDet = segExtent * det;
|
|
98
|
+
if (s0 >= 0) {
|
|
99
|
+
if (s1 >= -extDet) {
|
|
100
|
+
if (s1 <= extDet) {
|
|
101
|
+
// region 0
|
|
102
|
+
// Minimum at interior points of ray and segment.
|
|
103
|
+
const invDet = 1 / det;
|
|
104
|
+
s0 *= invDet;
|
|
105
|
+
s1 *= invDet;
|
|
106
|
+
sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// region 1
|
|
110
|
+
s1 = segExtent;
|
|
111
|
+
s0 = Math.max(0, -(a01 * s1 + b0));
|
|
112
|
+
sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// region 5
|
|
117
|
+
s1 = -segExtent;
|
|
118
|
+
s0 = Math.max(0, -(a01 * s1 + b0));
|
|
119
|
+
sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (s1 <= -extDet) {
|
|
123
|
+
// region 4
|
|
124
|
+
s0 = Math.max(0, -(-a01 * segExtent + b0));
|
|
125
|
+
s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
|
|
126
|
+
sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
|
|
127
|
+
}
|
|
128
|
+
else if (s1 <= extDet) {
|
|
129
|
+
// region 3
|
|
130
|
+
s0 = 0;
|
|
131
|
+
s1 = Math.min(Math.max(-segExtent, -b1), segExtent);
|
|
132
|
+
sqrDist = s1 * (s1 + 2 * b1) + c;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// region 2
|
|
136
|
+
s0 = Math.max(0, -(a01 * segExtent + b0));
|
|
137
|
+
s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
|
|
138
|
+
sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Ray and segment are parallel.
|
|
143
|
+
s1 = a01 > 0 ? -segExtent : segExtent;
|
|
144
|
+
s0 = Math.max(0, -(a01 * s1 + b0));
|
|
145
|
+
sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
|
|
146
|
+
}
|
|
147
|
+
if (optionalPointOnRay) {
|
|
148
|
+
optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0);
|
|
149
|
+
}
|
|
150
|
+
if (optionalPointOnSegment) {
|
|
151
|
+
optionalPointOnSegment.copy(_segCenter).addScaledVector(_segDir, s1);
|
|
152
|
+
}
|
|
153
|
+
return sqrDist;
|
|
154
|
+
}
|
|
155
|
+
intersectSphere(sphere, target) {
|
|
156
|
+
_vector.subVectors(sphere.center, this.origin);
|
|
157
|
+
const tca = _vector.dot(this.direction);
|
|
158
|
+
const d2 = _vector.dot(_vector) - tca * tca;
|
|
159
|
+
const radius2 = sphere.radius * sphere.radius;
|
|
160
|
+
if (d2 > radius2)
|
|
161
|
+
return null;
|
|
162
|
+
const thc = Math.sqrt(radius2 - d2);
|
|
163
|
+
// t0 = first intersect point - entrance on front of sphere
|
|
164
|
+
const t0 = tca - thc;
|
|
165
|
+
// t1 = second intersect point - exit point on back of sphere
|
|
166
|
+
const t1 = tca + thc;
|
|
167
|
+
// test to see if t1 is behind the ray - if so, return null
|
|
168
|
+
if (t1 < 0)
|
|
169
|
+
return null;
|
|
170
|
+
// test to see if t0 is behind the ray:
|
|
171
|
+
// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
|
|
172
|
+
// in order to always return an intersect point that is in front of the ray.
|
|
173
|
+
if (t0 < 0)
|
|
174
|
+
return this.at(t1, target);
|
|
175
|
+
// else t0 is in front of the ray, so return the first collision point scaled by t0
|
|
176
|
+
return this.at(t0, target);
|
|
177
|
+
}
|
|
178
|
+
intersectsSphere(sphere) {
|
|
179
|
+
if (sphere.radius < 0)
|
|
180
|
+
return false; // handle empty spheres, see #31187
|
|
181
|
+
return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;
|
|
182
|
+
}
|
|
183
|
+
distanceToPlane(plane) {
|
|
184
|
+
const denominator = _normalDot(plane.normal, this.direction);
|
|
185
|
+
if (denominator === 0) {
|
|
186
|
+
// line is coplanar, return origin
|
|
187
|
+
if (plane.distanceToPoint(this.origin) === 0) {
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
190
|
+
// Null is preferable to undefined since undefined means.... it is undefined
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const t = -(_originDot(this.origin, plane.normal) + plane.constant) / denominator;
|
|
194
|
+
// Return if the ray never intersects the plane
|
|
195
|
+
return t >= 0 ? t : null;
|
|
196
|
+
}
|
|
197
|
+
intersectPlane(plane, target) {
|
|
198
|
+
const t = this.distanceToPlane(plane);
|
|
199
|
+
if (t === null) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return this.at(t, target);
|
|
203
|
+
}
|
|
204
|
+
intersectsPlane(plane) {
|
|
205
|
+
// check if the ray lies on the plane first
|
|
206
|
+
const distToPoint = plane.distanceToPoint(this.origin);
|
|
207
|
+
if (distToPoint === 0) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
const denominator = _normalDot(plane.normal, this.direction);
|
|
211
|
+
if (denominator * distToPoint < 0) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
// ray origin is behind the plane (and is pointing behind it)
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
intersectBox(box, target) {
|
|
218
|
+
let tmin;
|
|
219
|
+
let tmax;
|
|
220
|
+
let tymin;
|
|
221
|
+
let tymax;
|
|
222
|
+
let tzmin;
|
|
223
|
+
let tzmax;
|
|
224
|
+
const invdirx = 1 / this.direction.x;
|
|
225
|
+
const invdiry = 1 / this.direction.y;
|
|
226
|
+
const invdirz = 1 / this.direction.z;
|
|
227
|
+
const origin = this.origin;
|
|
228
|
+
if (invdirx >= 0) {
|
|
229
|
+
tmin = (box.min.x - origin.x) * invdirx;
|
|
230
|
+
tmax = (box.max.x - origin.x) * invdirx;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
tmin = (box.max.x - origin.x) * invdirx;
|
|
234
|
+
tmax = (box.min.x - origin.x) * invdirx;
|
|
235
|
+
}
|
|
236
|
+
if (invdiry >= 0) {
|
|
237
|
+
tymin = (box.min.y - origin.y) * invdiry;
|
|
238
|
+
tymax = (box.max.y - origin.y) * invdiry;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
tymin = (box.max.y - origin.y) * invdiry;
|
|
242
|
+
tymax = (box.min.y - origin.y) * invdiry;
|
|
243
|
+
}
|
|
244
|
+
if (tmin > tymax || tymin > tmax)
|
|
245
|
+
return null;
|
|
246
|
+
if (tymin > tmin || isNaN(tmin))
|
|
247
|
+
tmin = tymin;
|
|
248
|
+
if (tymax < tmax || isNaN(tmax))
|
|
249
|
+
tmax = tymax;
|
|
250
|
+
if (invdirz >= 0) {
|
|
251
|
+
tzmin = (box.min.z - origin.z) * invdirz;
|
|
252
|
+
tzmax = (box.max.z - origin.z) * invdirz;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
tzmin = (box.max.z - origin.z) * invdirz;
|
|
256
|
+
tzmax = (box.min.z - origin.z) * invdirz;
|
|
257
|
+
}
|
|
258
|
+
if (tmin > tzmax || tzmin > tmax)
|
|
259
|
+
return null;
|
|
260
|
+
if (tzmin > tmin || tmin !== tmin)
|
|
261
|
+
tmin = tzmin;
|
|
262
|
+
if (tzmax < tmax || tmax !== tmax)
|
|
263
|
+
tmax = tzmax;
|
|
264
|
+
//return point closest to the ray (positive side)
|
|
265
|
+
if (tmax < 0)
|
|
266
|
+
return null;
|
|
267
|
+
return this.at(tmin >= 0 ? tmin : tmax, target);
|
|
268
|
+
}
|
|
269
|
+
intersectsBox(box) {
|
|
270
|
+
return this.intersectBox(box, _vector) !== null;
|
|
271
|
+
}
|
|
272
|
+
intersectTriangle(a, b, c, backfaceCulling, target) {
|
|
273
|
+
// Compute the offset origin, edges, and normal.
|
|
274
|
+
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
|
|
275
|
+
_edge1.subVectors(b, a);
|
|
276
|
+
_edge2.subVectors(c, a);
|
|
277
|
+
_normal.crossVectors(_edge1, _edge2);
|
|
278
|
+
// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
|
|
279
|
+
// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
|
|
280
|
+
// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
|
|
281
|
+
// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
|
|
282
|
+
// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
|
|
283
|
+
let DdN = this.direction.dot(_normal);
|
|
284
|
+
let sign;
|
|
285
|
+
if (DdN > 0) {
|
|
286
|
+
if (backfaceCulling)
|
|
287
|
+
return null;
|
|
288
|
+
sign = 1;
|
|
289
|
+
}
|
|
290
|
+
else if (DdN < 0) {
|
|
291
|
+
sign = -1;
|
|
292
|
+
DdN = -DdN;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
_diff.subVectors(this.origin, a);
|
|
298
|
+
const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2));
|
|
299
|
+
// b1 < 0, no intersection
|
|
300
|
+
if (DdQxE2 < 0) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff));
|
|
304
|
+
// b2 < 0, no intersection
|
|
305
|
+
if (DdE1xQ < 0) {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
// b1+b2 > 1, no intersection
|
|
309
|
+
if (DdQxE2 + DdE1xQ > DdN) {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
// Line intersects triangle, check if ray does.
|
|
313
|
+
const QdN = -sign * _diff.dot(_normal);
|
|
314
|
+
// t < 0, no intersection
|
|
315
|
+
if (QdN < 0) {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
// Ray intersects triangle.
|
|
319
|
+
return this.at(QdN / DdN, target);
|
|
320
|
+
}
|
|
321
|
+
applyMatrix4(matrix4) {
|
|
322
|
+
this.origin.applyMatrix4(matrix4);
|
|
323
|
+
this.direction.transformDirection(matrix4);
|
|
324
|
+
return this;
|
|
325
|
+
}
|
|
326
|
+
equals(ray) {
|
|
327
|
+
return this.origin.equals(ray.origin) && this.direction.equals(ray.direction);
|
|
328
|
+
}
|
|
329
|
+
clone() {
|
|
330
|
+
return new this.constructor().copy(this);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// `plane.normal` may be a compat Vector3 or an immutable one; the dot products below multiply the same pairs in the same order as three's.
|
|
334
|
+
function _normalDot(normal, direction) {
|
|
335
|
+
return normal.x * direction.x + normal.y * direction.y + normal.z * direction.z;
|
|
336
|
+
}
|
|
337
|
+
function _originDot(origin, normal) {
|
|
338
|
+
return origin.x * normal.x + origin.y * normal.y + origin.z * normal.z;
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=Ray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ray.js","sourceRoot":"","sources":["../../../../../packages/math/src/three/Ray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqBvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,UAAU,GAAG,IAAI,OAAO,EAAE,CAAC;AACjC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;AAE5B,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;AAC7B,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;AAC7B,MAAM,OAAO,GAAG,IAAI,OA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|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Sphere as ImmutableSphere } from "../Sphere.js";
|
|
2
|
+
import { Box3 } from "./Box3.js";
|
|
3
|
+
import { Vector3 } from "./Vector3.js";
|
|
4
|
+
import type { Vector3Like } from "./Vector3.js";
|
|
5
|
+
/** Anything with a `center` and `radius`, including the immutable `@aura3d/math` Sphere. */
|
|
6
|
+
export interface SphereLike {
|
|
7
|
+
readonly center: Vector3Like;
|
|
8
|
+
readonly radius: number;
|
|
9
|
+
}
|
|
10
|
+
interface PlaneLike {
|
|
11
|
+
distanceToPoint(point: Vector3): number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Mutable three.js-compatible bounding sphere (`radius = -1` is the empty
|
|
15
|
+
* sentinel). Every modifier mutates `this` and returns `this`, exactly like
|
|
16
|
+
* three r185 `Sphere`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class Sphere {
|
|
19
|
+
readonly isSphere: true;
|
|
20
|
+
center: Vector3;
|
|
21
|
+
radius: number;
|
|
22
|
+
constructor(center?: Vector3, radius?: number);
|
|
23
|
+
/** Copy an immutable `@aura3d/math` Sphere (or any `{center, radius}`) into this sphere. */
|
|
24
|
+
fromImmutable(sphere: SphereLike): this;
|
|
25
|
+
/** Snapshot as an immutable `@aura3d/math` Sphere (throws on a non-finite radius, like that class). */
|
|
26
|
+
toImmutable(): ImmutableSphere;
|
|
27
|
+
set(center: Vector3Like, radius: number): this;
|
|
28
|
+
setFromPoints(points: readonly Vector3[], optionalCenter?: Vector3Like): this;
|
|
29
|
+
copy(sphere: SphereLike): this;
|
|
30
|
+
isEmpty(): boolean;
|
|
31
|
+
makeEmpty(): this;
|
|
32
|
+
containsPoint(point: Vector3): boolean;
|
|
33
|
+
distanceToPoint(point: Vector3): number;
|
|
34
|
+
intersectsSphere(sphere: SphereLike): boolean;
|
|
35
|
+
intersectsBox(box: Box3): boolean;
|
|
36
|
+
intersectsPlane(plane: PlaneLike): boolean;
|
|
37
|
+
clampPoint(point: Vector3, target: Vector3): Vector3;
|
|
38
|
+
getBoundingBox(target: Box3): Box3;
|
|
39
|
+
applyMatrix4(matrix: {
|
|
40
|
+
readonly elements: ArrayLike<number>;
|
|
41
|
+
getMaxScaleOnAxis(): number;
|
|
42
|
+
}): this;
|
|
43
|
+
translate(offset: Vector3Like): this;
|
|
44
|
+
expandByPoint(point: Vector3Like): this;
|
|
45
|
+
union(sphere: Sphere): this;
|
|
46
|
+
equals(sphere: SphereLike): boolean;
|
|
47
|
+
clone(): this;
|
|
48
|
+
toJSON(): {
|
|
49
|
+
radius: number;
|
|
50
|
+
center: number[];
|
|
51
|
+
};
|
|
52
|
+
fromJSON(json: {
|
|
53
|
+
radius: number;
|
|
54
|
+
center: ArrayLike<number>;
|
|
55
|
+
}): this;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=Sphere.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sphere.d.ts","sourceRoot":"","sources":["../../../../../packages/math/src/three/Sphere.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,4FAA4F;AAC5F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,SAAS;IACjB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;CACzC;AAMD;;;;GAIG;AACH,qBAAa,MAAM;IACjB,SAAiB,QAAQ,EAAE,IAAI,CAAC;IAEhC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAA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CAAA;KAAE;IAO9C,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;KAAE,GAAG,IAAI;CAKpE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Sphere as ImmutableSphere } from "../Sphere.js";
|
|
2
|
+
import { Box3 } from "./Box3.js";
|
|
3
|
+
import { Vector3 } from "./Vector3.js";
|
|
4
|
+
const _box = new Box3();
|
|
5
|
+
const _v1 = new Vector3();
|
|
6
|
+
const _v2 = new Vector3();
|
|
7
|
+
/**
|
|
8
|
+
* Mutable three.js-compatible bounding sphere (`radius = -1` is the empty
|
|
9
|
+
* sentinel). Every modifier mutates `this` and returns `this`, exactly like
|
|
10
|
+
* three r185 `Sphere`.
|
|
11
|
+
*/
|
|
12
|
+
export class Sphere {
|
|
13
|
+
center;
|
|
14
|
+
radius;
|
|
15
|
+
constructor(center = new Vector3(), radius = -1) {
|
|
16
|
+
this.center = center;
|
|
17
|
+
this.radius = radius;
|
|
18
|
+
}
|
|
19
|
+
/** Copy an immutable `@aura3d/math` Sphere (or any `{center, radius}`) into this sphere. */
|
|
20
|
+
fromImmutable(sphere) {
|
|
21
|
+
this.center.copy(sphere.center);
|
|
22
|
+
this.radius = sphere.radius;
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
/** Snapshot as an immutable `@aura3d/math` Sphere (throws on a non-finite radius, like that class). */
|
|
26
|
+
toImmutable() {
|
|
27
|
+
return new ImmutableSphere(this.center.toImmutable(), this.radius);
|
|
28
|
+
}
|
|
29
|
+
set(center, radius) {
|
|
30
|
+
this.center.copy(center);
|
|
31
|
+
this.radius = radius;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
setFromPoints(points, optionalCenter) {
|
|
35
|
+
const center = this.center;
|
|
36
|
+
if (optionalCenter !== undefined) {
|
|
37
|
+
center.copy(optionalCenter);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
_box.setFromPoints(points).getCenter(center);
|
|
41
|
+
}
|
|
42
|
+
let maxRadiusSq = 0;
|
|
43
|
+
for (let i = 0, il = points.length; i < il; i += 1) {
|
|
44
|
+
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));
|
|
45
|
+
}
|
|
46
|
+
this.radius = Math.sqrt(maxRadiusSq);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
copy(sphere) {
|
|
50
|
+
this.center.copy(sphere.center);
|
|
51
|
+
this.radius = sphere.radius;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
isEmpty() {
|
|
55
|
+
return this.radius < 0;
|
|
56
|
+
}
|
|
57
|
+
makeEmpty() {
|
|
58
|
+
this.center.set(0, 0, 0);
|
|
59
|
+
this.radius = -1;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
containsPoint(point) {
|
|
63
|
+
return point.distanceToSquared(this.center) <= this.radius * this.radius;
|
|
64
|
+
}
|
|
65
|
+
distanceToPoint(point) {
|
|
66
|
+
return point.distanceTo(this.center) - this.radius;
|
|
67
|
+
}
|
|
68
|
+
intersectsSphere(sphere) {
|
|
69
|
+
const radiusSum = this.radius + sphere.radius;
|
|
70
|
+
return _distanceSq(sphere.center, this.center) <= radiusSum * radiusSum;
|
|
71
|
+
}
|
|
72
|
+
intersectsBox(box) {
|
|
73
|
+
return box.intersectsSphere(this);
|
|
74
|
+
}
|
|
75
|
+
intersectsPlane(plane) {
|
|
76
|
+
return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;
|
|
77
|
+
}
|
|
78
|
+
clampPoint(point, target) {
|
|
79
|
+
const deltaLengthSq = this.center.distanceToSquared(point);
|
|
80
|
+
target.copy(point);
|
|
81
|
+
if (deltaLengthSq > this.radius * this.radius) {
|
|
82
|
+
target.sub(this.center).normalize();
|
|
83
|
+
target.multiplyScalar(this.radius).add(this.center);
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
getBoundingBox(target) {
|
|
88
|
+
if (this.isEmpty()) {
|
|
89
|
+
// Empty sphere produces empty bounding box
|
|
90
|
+
target.makeEmpty();
|
|
91
|
+
return target;
|
|
92
|
+
}
|
|
93
|
+
target.set(this.center, this.center);
|
|
94
|
+
target.expandByScalar(this.radius);
|
|
95
|
+
return target;
|
|
96
|
+
}
|
|
97
|
+
applyMatrix4(matrix) {
|
|
98
|
+
this.center.applyMatrix4(matrix);
|
|
99
|
+
this.radius = this.radius * matrix.getMaxScaleOnAxis();
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
translate(offset) {
|
|
103
|
+
this.center.add(offset);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
expandByPoint(point) {
|
|
107
|
+
if (this.isEmpty()) {
|
|
108
|
+
this.center.copy(point);
|
|
109
|
+
this.radius = 0;
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
_v1.subVectors(point, this.center);
|
|
113
|
+
const lengthSq = _v1.lengthSq();
|
|
114
|
+
if (lengthSq > this.radius * this.radius) {
|
|
115
|
+
// calculate the minimal sphere
|
|
116
|
+
const length = Math.sqrt(lengthSq);
|
|
117
|
+
const delta = (length - this.radius) * 0.5;
|
|
118
|
+
this.center.addScaledVector(_v1, delta / length);
|
|
119
|
+
this.radius += delta;
|
|
120
|
+
}
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
union(sphere) {
|
|
124
|
+
if (sphere.isEmpty()) {
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
if (this.isEmpty()) {
|
|
128
|
+
this.copy(sphere);
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
if (this.center.equals(sphere.center) === true) {
|
|
132
|
+
this.radius = Math.max(this.radius, sphere.radius);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
_v2.subVectors(sphere.center, this.center).setLength(sphere.radius);
|
|
136
|
+
this.expandByPoint(_v1.copy(sphere.center).add(_v2));
|
|
137
|
+
this.expandByPoint(_v1.copy(sphere.center).sub(_v2));
|
|
138
|
+
}
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
equals(sphere) {
|
|
142
|
+
return this.center.equals(sphere.center) && sphere.radius === this.radius;
|
|
143
|
+
}
|
|
144
|
+
clone() {
|
|
145
|
+
return new this.constructor().copy(this);
|
|
146
|
+
}
|
|
147
|
+
toJSON() {
|
|
148
|
+
return {
|
|
149
|
+
radius: this.radius,
|
|
150
|
+
center: this.center.toArray()
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
fromJSON(json) {
|
|
154
|
+
this.radius = json.radius;
|
|
155
|
+
this.center.fromArray(json.center);
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
Sphere.prototype.isSphere = true;
|
|
160
|
+
function _distanceSq(a, b) {
|
|
161
|
+
const dx = a.x - b.x;
|
|
162
|
+
const dy = a.y - b.y;
|
|
163
|
+
const dz = a.z - b.z;
|
|
164
|
+
return dx * dx + dy * dy + dz * dz;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=Sphere.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sphere.js","sourceRoot":"","sources":["../../../../../packages/math/src/three/Sphere.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAavC,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;AACxB,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;AAC1B,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;AAE1B;;;;GAIG;AACH,MAAM,OAAO,MAAM;IAGjB,MAAM,CAAU;IAChB,MAAM,CAAS;IA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CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Vector3 } from "./Vector3.js";
|
|
2
|
+
import { Vector4 } from "./Vector4.js";
|
|
3
|
+
import type { Vector3Like } from "./Vector3.js";
|
|
4
|
+
import type { BufferAttributeLike3 } from "./Vector3.js";
|
|
5
|
+
import type { BufferAttributeLikeW } from "./Vector4.js";
|
|
6
|
+
import type { Plane } from "./Plane.js";
|
|
7
|
+
/** Anything with `a`, `b`, `c` corners, including the immutable `@aura3d/math` Triangle. */
|
|
8
|
+
export interface TriangleCornersLike {
|
|
9
|
+
readonly a: Vector3Like;
|
|
10
|
+
readonly b: Vector3Like;
|
|
11
|
+
readonly c: Vector3Like;
|
|
12
|
+
}
|
|
13
|
+
/** Writable vector target that `getInterpolation` accumulates into (Vector2, Vector3 or Vector4). */
|
|
14
|
+
interface InterpolationTarget {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
setScalar(scalar: number): unknown;
|
|
18
|
+
addScaledVector(v: never, s: number): unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mutable three.js-compatible triangle. Every modifier mutates `this` and
|
|
22
|
+
* returns `this`, exactly like three r185 `Triangle`, including the static
|
|
23
|
+
* helpers and `null` for a degenerate `getBarycoord`.
|
|
24
|
+
*/
|
|
25
|
+
export declare class Triangle {
|
|
26
|
+
a: Vector3;
|
|
27
|
+
b: Vector3;
|
|
28
|
+
c: Vector3;
|
|
29
|
+
constructor(a?: Vector3, b?: Vector3, c?: Vector3);
|
|
30
|
+
/** Copy an immutable `@aura3d/math` Triangle (or any `{a, b, c}`) into this triangle. */
|
|
31
|
+
fromImmutable(triangle: TriangleCornersLike): this;
|
|
32
|
+
static getNormal(a: Vector3Like, b: Vector3Like, c: Vector3Like, target: Vector3): Vector3;
|
|
33
|
+
static getBarycoord(point: Vector3Like, a: Vector3Like, b: Vector3Like, c: Vector3Like, target: Vector3): Vector3 | null;
|
|
34
|
+
static containsPoint(point: Vector3Like, a: Vector3Like, b: Vector3Like, c: Vector3Like): boolean;
|
|
35
|
+
static getInterpolation<T extends InterpolationTarget>(point: Vector3Like, p1: Vector3Like, p2: Vector3Like, p3: Vector3Like, v1: unknown, v2: unknown, v3: unknown, target: T): T | null;
|
|
36
|
+
static getInterpolatedAttribute(attr: BufferAttributeLikeW & BufferAttributeLike3, i1: number, i2: number, i3: number, barycoord: Vector3Like, target: Vector3 | Vector4): Vector3 | Vector4;
|
|
37
|
+
static isFrontFacing(a: Vector3Like, b: Vector3Like, c: Vector3Like, direction: Vector3Like): boolean;
|
|
38
|
+
set(a: Vector3Like, b: Vector3Like, c: Vector3Like): this;
|
|
39
|
+
setFromPointsAndIndices(points: readonly Vector3Like[], i0: number, i1: number, i2: number): this;
|
|
40
|
+
setFromAttributeAndIndices(attribute: BufferAttributeLike3, i0: number, i1: number, i2: number): this;
|
|
41
|
+
clone(): this;
|
|
42
|
+
copy(triangle: TriangleCornersLike): this;
|
|
43
|
+
getArea(): number;
|
|
44
|
+
getMidpoint(target: Vector3): Vector3;
|
|
45
|
+
getNormal(target: Vector3): Vector3;
|
|
46
|
+
getPlane(target: Plane): Plane;
|
|
47
|
+
getBarycoord(point: Vector3Like, target: Vector3): Vector3 | null;
|
|
48
|
+
getInterpolation<T extends InterpolationTarget>(point: Vector3Like, v1: unknown, v2: unknown, v3: unknown, target: T): T | null;
|
|
49
|
+
containsPoint(point: Vector3Like): boolean;
|
|
50
|
+
isFrontFacing(direction: Vector3Like): boolean;
|
|
51
|
+
intersectsBox(box: {
|
|
52
|
+
intersectsTriangle(triangle: Triangle): boolean;
|
|
53
|
+
}): boolean;
|
|
54
|
+
closestPointToPoint(p: Vector3Like, target: Vector3): Vector3;
|
|
55
|
+
equals(triangle: TriangleCornersLike): boolean;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=Triangle.d.ts.map
|