@vertexvis/geometry 0.24.5-canary.4 → 1.0.0-testing.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/angle.d.ts +35 -35
- package/dist/boundingBox.d.ts +49 -49
- package/dist/boundingSphere.d.ts +14 -14
- package/dist/bundle.cjs.js +2148 -2148
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +2148 -2148
- package/dist/bundle.esm.js.map +1 -1
- package/dist/cdn/bundle.esm.js +2149 -2183
- package/dist/cdn/bundle.esm.js.map +1 -1
- package/dist/cdn/bundle.esm.min.js +1 -15
- package/dist/cdn/bundle.esm.min.js.map +1 -1
- package/dist/dimensions.d.ts +94 -94
- package/dist/euler.d.ts +57 -57
- package/dist/index.d.ts +21 -21
- package/dist/line3.d.ts +48 -48
- package/dist/math.d.ts +20 -20
- package/dist/matrix.d.ts +73 -73
- package/dist/matrix2.d.ts +29 -29
- package/dist/matrix4.d.ts +285 -285
- package/dist/plane.d.ts +51 -51
- package/dist/point.d.ts +80 -80
- package/dist/quaternion.d.ts +65 -65
- package/dist/ray.d.ts +52 -52
- package/dist/rectangle.d.ts +125 -125
- package/dist/vector3.d.ts +226 -226
- package/dist/vector4.d.ts +23 -23
- package/package.json +10 -10
- package/dist/cdn/__tests__/angle.test.d.ts +0 -1
- package/dist/cdn/__tests__/boundingBox.test.d.ts +0 -1
- package/dist/cdn/__tests__/boundingSphere.test.d.ts +0 -1
- package/dist/cdn/__tests__/dimensions.test.d.ts +0 -1
- package/dist/cdn/__tests__/euler.test.d.ts +0 -1
- package/dist/cdn/__tests__/line3.test.d.ts +0 -1
- package/dist/cdn/__tests__/math.spec.d.ts +0 -1
- package/dist/cdn/__tests__/matrix.test.d.ts +0 -1
- package/dist/cdn/__tests__/matrix2.test.d.ts +0 -1
- package/dist/cdn/__tests__/matrix4.test.d.ts +0 -1
- package/dist/cdn/__tests__/plane.test.d.ts +0 -1
- package/dist/cdn/__tests__/point.test.d.ts +0 -1
- package/dist/cdn/__tests__/quaternion.test.d.ts +0 -1
- package/dist/cdn/__tests__/ray.test.d.ts +0 -1
- package/dist/cdn/__tests__/rectangle.test.d.ts +0 -1
- package/dist/cdn/__tests__/vector3.test.d.ts +0 -1
- package/dist/cdn/__tests__/vector4.test.d.ts +0 -1
- package/dist/cdn/angle.d.ts +0 -35
- package/dist/cdn/boundingBox.d.ts +0 -49
- package/dist/cdn/boundingSphere.d.ts +0 -14
- package/dist/cdn/dimensions.d.ts +0 -94
- package/dist/cdn/euler.d.ts +0 -57
- package/dist/cdn/index.d.ts +0 -21
- package/dist/cdn/line3.d.ts +0 -48
- package/dist/cdn/math.d.ts +0 -20
- package/dist/cdn/matrix.d.ts +0 -73
- package/dist/cdn/matrix2.d.ts +0 -29
- package/dist/cdn/matrix4.d.ts +0 -285
- package/dist/cdn/plane.d.ts +0 -51
- package/dist/cdn/point.d.ts +0 -80
- package/dist/cdn/quaternion.d.ts +0 -65
- package/dist/cdn/ray.d.ts +0 -52
- package/dist/cdn/rectangle.d.ts +0 -125
- package/dist/cdn/vector3.d.ts +0 -226
- package/dist/cdn/vector4.d.ts +0 -23
package/dist/cdn/matrix4.d.ts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import * as Quaternion from './quaternion';
|
|
2
|
-
import * as Vector3 from './vector3';
|
|
3
|
-
/**
|
|
4
|
-
* A type alias representing a 4x4 column-major matrix.
|
|
5
|
-
*
|
|
6
|
-
* The common use-case for 4x4 matrices in 3D computer graphics are for
|
|
7
|
-
* [transformation
|
|
8
|
-
* matrices](https://en.wikipedia.org/wiki/Transformation_matrix). This allows a
|
|
9
|
-
* point in 3D space to be projected onto a 2D screen using transformations such
|
|
10
|
-
* as translation, rotation and scale.
|
|
11
|
-
*/
|
|
12
|
-
export declare type Matrix4 = [
|
|
13
|
-
number,
|
|
14
|
-
number,
|
|
15
|
-
number,
|
|
16
|
-
number,
|
|
17
|
-
number,
|
|
18
|
-
number,
|
|
19
|
-
number,
|
|
20
|
-
number,
|
|
21
|
-
number,
|
|
22
|
-
number,
|
|
23
|
-
number,
|
|
24
|
-
number,
|
|
25
|
-
number,
|
|
26
|
-
number,
|
|
27
|
-
number,
|
|
28
|
-
number
|
|
29
|
-
];
|
|
30
|
-
/**
|
|
31
|
-
* An object representation of a `Matrix4`, where each value is represented as:
|
|
32
|
-
*
|
|
33
|
-
* ```
|
|
34
|
-
* m11 m12 m13 m14
|
|
35
|
-
* m21 m22 m23 m24
|
|
36
|
-
* m31 m32 m33 m34
|
|
37
|
-
* m41 m42 m43 m44
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* `Matrix4` arrays can be converted to an object using {@link toObject}.
|
|
41
|
-
*/
|
|
42
|
-
export interface Matrix4AsObject {
|
|
43
|
-
m11: number;
|
|
44
|
-
m12: number;
|
|
45
|
-
m13: number;
|
|
46
|
-
m14: number;
|
|
47
|
-
m21: number;
|
|
48
|
-
m22: number;
|
|
49
|
-
m23: number;
|
|
50
|
-
m24: number;
|
|
51
|
-
m31: number;
|
|
52
|
-
m32: number;
|
|
53
|
-
m33: number;
|
|
54
|
-
m34: number;
|
|
55
|
-
m41: number;
|
|
56
|
-
m42: number;
|
|
57
|
-
m43: number;
|
|
58
|
-
m44: number;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Creates a 4x4 matrix from a set of row-major components.
|
|
62
|
-
*/
|
|
63
|
-
export declare function fromValues(m11: number, m12: number, m13: number, m14: number, m21: number, m22: number, m23: number, m24: number, m31: number, m32: number, m33: number, m34: number, m41: number, m42: number, m43: number, m44: number): Matrix4;
|
|
64
|
-
/**
|
|
65
|
-
* Creates a `Matrix4` from an object representation.
|
|
66
|
-
*/
|
|
67
|
-
export declare function fromObject(obj: Matrix4AsObject): Matrix4;
|
|
68
|
-
/**
|
|
69
|
-
* Returns a new [identity matrix](https://en.wikipedia.org/wiki/Identity_matrix).
|
|
70
|
-
*/
|
|
71
|
-
export declare function makeIdentity(): Matrix4;
|
|
72
|
-
/**
|
|
73
|
-
* Returns a matrix with all values as 0.
|
|
74
|
-
*/
|
|
75
|
-
export declare function makeZero(): Matrix4;
|
|
76
|
-
/**
|
|
77
|
-
* Creates a translation matrix.
|
|
78
|
-
*
|
|
79
|
-
* ```
|
|
80
|
-
* 1, 0, 0, 0,
|
|
81
|
-
* 0, 1, 0, 0,
|
|
82
|
-
* 0, 0, 1, 0,
|
|
83
|
-
* x, y, z, 1
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @param translation A vector representing the translation components.
|
|
87
|
-
* @returns A translation matrix.
|
|
88
|
-
*/
|
|
89
|
-
export declare function makeTranslation(translation: Vector3.Vector3): Matrix4;
|
|
90
|
-
/**
|
|
91
|
-
* Creates a rotation matrix.
|
|
92
|
-
*
|
|
93
|
-
* ```
|
|
94
|
-
* 1-2y²-2z², 2xy-2zw, 2xz+2yw, 0,
|
|
95
|
-
* 2xy+2zw, 1-2x²-2z², 2yz-2xw, 0,
|
|
96
|
-
* 2xz-2yw, 2yz+2xw, 1-2x²-2y², 0,
|
|
97
|
-
* 0, 0, 0, 1,
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @param rotation A quaternion representing the rotation.
|
|
101
|
-
* @see https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion
|
|
102
|
-
* @returns A rotation matrix.
|
|
103
|
-
*/
|
|
104
|
-
export declare function makeRotation(rotation: Quaternion.Quaternion): Matrix4;
|
|
105
|
-
/**
|
|
106
|
-
* Creates a scale matrix.
|
|
107
|
-
*
|
|
108
|
-
* ```
|
|
109
|
-
* x, 0, 0, 0,
|
|
110
|
-
* 0, y, 0, 0,
|
|
111
|
-
* 0, 0, z, 0,
|
|
112
|
-
* 0, 0, 0, 1
|
|
113
|
-
* ```
|
|
114
|
-
*
|
|
115
|
-
* @param scale A vector representing the different scale components.
|
|
116
|
-
* @returns A scale matrix.
|
|
117
|
-
*/
|
|
118
|
-
export declare function makeScale(scale: Vector3.Vector3): Matrix4;
|
|
119
|
-
/**
|
|
120
|
-
* Creates a matrix that has translation, rotation and scale applied to it.
|
|
121
|
-
*
|
|
122
|
-
* @param translation The translation applied to the matrix.
|
|
123
|
-
* @param rotation The rotation applied to the matrix.
|
|
124
|
-
* @param scale The scale applied to the matrix.
|
|
125
|
-
* @returns A transformed matrix.
|
|
126
|
-
*/
|
|
127
|
-
export declare function makeTRS(translation: Vector3.Vector3, rotation: Quaternion.Quaternion, scale: Vector3.Vector3): Matrix4;
|
|
128
|
-
/**
|
|
129
|
-
* Returns a matrix that has the basis components (upper left 3x3 matrix) set to
|
|
130
|
-
* the following x, y, and z axis.
|
|
131
|
-
*
|
|
132
|
-
* ```
|
|
133
|
-
* x.x y.x z.x 0
|
|
134
|
-
* x.y y.y z.y 0
|
|
135
|
-
* x.z y.z z.z 0
|
|
136
|
-
* 0 0 0 0
|
|
137
|
-
* ```
|
|
138
|
-
*
|
|
139
|
-
* @param x The x axis to set.
|
|
140
|
-
* @param y The y axis to set.
|
|
141
|
-
* @param z The z axis to set.
|
|
142
|
-
* @returns A matrix with its basis components populated.
|
|
143
|
-
*/
|
|
144
|
-
export declare function makeBasis(x: Vector3.Vector3, y: Vector3.Vector3, z: Vector3.Vector3): Matrix4;
|
|
145
|
-
/**
|
|
146
|
-
* Creates a rotation matrix that is rotated around a given axis by the given
|
|
147
|
-
* angle.
|
|
148
|
-
*
|
|
149
|
-
* @param axis The axis of rotation.
|
|
150
|
-
* @param radians The angle of rotation.
|
|
151
|
-
* @returns A rotation matrix.
|
|
152
|
-
*/
|
|
153
|
-
export declare function makeRotationAxis(axis: Vector3.Vector3, radians: number): Matrix4;
|
|
154
|
-
/**
|
|
155
|
-
* Creates a matrix used for [perspective
|
|
156
|
-
* projections](https://en.wikipedia.org/wiki/3D_projection#Perspective_projection).
|
|
157
|
-
*
|
|
158
|
-
* The viewing volume is frustum-shaped and defined by the six parameters. Left,
|
|
159
|
-
* right, top, and bottom specify coordinates in the near clipping plane where
|
|
160
|
-
* the frustum edges intersect it, and the near and far parameters define the
|
|
161
|
-
* forward distances of the view volume. The resulting volume can be vertically
|
|
162
|
-
* and horizontally asymmetrical around the center of the near plane.
|
|
163
|
-
*
|
|
164
|
-
* @param left The left coordinate at the near plane.
|
|
165
|
-
* @param right The right coordinate at the near plane.
|
|
166
|
-
* @param top The top coordinate at the near plane.
|
|
167
|
-
* @param bottom The bottom coordinate at the near plane.
|
|
168
|
-
* @param near The near distance.
|
|
169
|
-
* @param far The far distance.
|
|
170
|
-
* @returns A matrix representing a view frustum.
|
|
171
|
-
*/
|
|
172
|
-
export declare function makeFrustum(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4;
|
|
173
|
-
/**
|
|
174
|
-
* Creates a perspective projection matrix.
|
|
175
|
-
*
|
|
176
|
-
* Related to: gluPerspective. The viewing volume is frustum-shaped amd defined
|
|
177
|
-
* by the four parameters. The fovy and aspect ratio are used to compute the
|
|
178
|
-
* positions of the left, right, top, and bottom sides of the viewing volume in
|
|
179
|
-
* the zNear plane. The fovy is the y field-of-view, the angle made by the top
|
|
180
|
-
* and bottom sides of frustum if they were to intersect. The aspect ratio is
|
|
181
|
-
* the width of the frustum divided by its height. Note that the resulting
|
|
182
|
-
* volume is both vertically and horizontally symmetrical around the center of
|
|
183
|
-
* the near plane.
|
|
184
|
-
*
|
|
185
|
-
* @param near The near Z value.
|
|
186
|
-
* @param far The far Z value.
|
|
187
|
-
* @param fovY The field of view.
|
|
188
|
-
* @param aspect The aspect ratio.
|
|
189
|
-
* @returns A matrix.
|
|
190
|
-
*/
|
|
191
|
-
export declare function makePerspective(near: number, far: number, fovY: number, aspect: number): Matrix4;
|
|
192
|
-
/**
|
|
193
|
-
* Creates an orthographic projection matrix.
|
|
194
|
-
*
|
|
195
|
-
* Related to: gluOrtho. The viewing volume is cube-shaped and defined by
|
|
196
|
-
* the six parameters. The left and right values represent the coordinates of
|
|
197
|
-
* the vertical clipping planes, top and bottom values represent the coordinates
|
|
198
|
-
* of the horizontal clipping planes, and near and far values represent the
|
|
199
|
-
* coordinates of the depth clipping planes.
|
|
200
|
-
*
|
|
201
|
-
* @param left The coordinate of the left horizontal clipping plane.
|
|
202
|
-
* @param right The coordinate of the right horizontal clipping plane.
|
|
203
|
-
* @param bottom The coordinate of the bottom vertical clipping plane.
|
|
204
|
-
* @param top The coordinate of the top vertical clipping plane.
|
|
205
|
-
* @param near The coordinate of the near depth clipping plane.
|
|
206
|
-
* @param far The coordinate of the far depth clipping plane.
|
|
207
|
-
* @returns A matrix.
|
|
208
|
-
*/
|
|
209
|
-
export declare function makeOrthographic(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
|
|
210
|
-
/**
|
|
211
|
-
* Matrix becomes a combination of an inverse translation and rotation.
|
|
212
|
-
*
|
|
213
|
-
* Related to: gluLookAt. This creates the inverse of makeLookAtMatrix. The
|
|
214
|
-
* matrix will be an opposite translation from the 'eye' position, and it will
|
|
215
|
-
* rotate things in the opposite direction of the eye-to-center orientation.
|
|
216
|
-
* This is definitely confusing, but the main reason to use this transform is to
|
|
217
|
-
* set up a view matrix for a camera that's looking at a certain point. To
|
|
218
|
-
* achieve the effect of moving the camera somewhere and rotating it so that it
|
|
219
|
-
* points at something, the rest of the world is moved in the opposite direction
|
|
220
|
-
* and rotated in the opposite way around the camera. This way, you get the same
|
|
221
|
-
* effect as moving the actual camera, but all the projection math can still be
|
|
222
|
-
* done with the camera positioned at the origin (which makes it way simpler).
|
|
223
|
-
*
|
|
224
|
-
* @param position The position of the object.
|
|
225
|
-
* @param lookAt The point which the object is looking at.
|
|
226
|
-
* @param up The direction which the object considers up.
|
|
227
|
-
* @returns A matrix.
|
|
228
|
-
*/
|
|
229
|
-
export declare function makeLookAtView(position: Vector3.Vector3, lookAt: Vector3.Vector3, up: Vector3.Vector3): Matrix4;
|
|
230
|
-
/**
|
|
231
|
-
* Matrix becomes a combination of translation and rotation.
|
|
232
|
-
*
|
|
233
|
-
* Matrix becomes a combination of a translation to the position of 'eye' and a
|
|
234
|
-
* rotation matrix which orients an object to point towards 'center' along its
|
|
235
|
-
* z-axis. Use this function if you want an object to look at a point from
|
|
236
|
-
* another point in space.
|
|
237
|
-
*
|
|
238
|
-
* @param position The position of the object.
|
|
239
|
-
* @param lookAt The point which the object is looking at.
|
|
240
|
-
* @param up The direction which the object considers up.
|
|
241
|
-
* @returns A matrix.
|
|
242
|
-
*/
|
|
243
|
-
export declare function makeLookAt(position: Vector3.Vector3, lookAt: Vector3.Vector3, up: Vector3.Vector3): Matrix4;
|
|
244
|
-
/**
|
|
245
|
-
* Returns the inverse of the given matrix. If the determinate of the matrix is
|
|
246
|
-
* zero, then a zero matrix is returned.
|
|
247
|
-
*/
|
|
248
|
-
export declare function invert(matrix: Matrix4): Matrix4;
|
|
249
|
-
/**
|
|
250
|
-
* Returns a rotation matrix looking from position towards target and oriented
|
|
251
|
-
* by an up vector.
|
|
252
|
-
*
|
|
253
|
-
* @param m The matrix to transform.
|
|
254
|
-
* @param position The point from which to look at target.
|
|
255
|
-
* @param target The point to look at.
|
|
256
|
-
* @param up The orientation.
|
|
257
|
-
* @returns A rotation matrix.
|
|
258
|
-
*/
|
|
259
|
-
export declare function lookAt(m: Matrix4, position: Vector3.Vector3, target: Vector3.Vector3, up: Vector3.Vector3): Matrix4;
|
|
260
|
-
/**
|
|
261
|
-
* Returns a post-multiplied matrix.
|
|
262
|
-
*/
|
|
263
|
-
export declare function multiply(a: Matrix4, b: Matrix4): Matrix4;
|
|
264
|
-
/**
|
|
265
|
-
* Returns the [transpose](https://en.wikipedia.org/wiki/Transpose) of the given
|
|
266
|
-
* matrix.
|
|
267
|
-
*/
|
|
268
|
-
export declare function transpose(matrix: Matrix4): Matrix4;
|
|
269
|
-
/**
|
|
270
|
-
* Multiplies the columns of a matrix by the given vector.
|
|
271
|
-
*/
|
|
272
|
-
export declare function scale(matrix: Matrix4, scale: Vector3.Vector3): Matrix4;
|
|
273
|
-
export declare function position(matrix: Matrix4, other: Matrix4): Matrix4;
|
|
274
|
-
/**
|
|
275
|
-
* Returns true if the matrix is an identity matrix.
|
|
276
|
-
*/
|
|
277
|
-
export declare function isIdentity(matrix: Matrix4): boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Returns an object representation of a `Matrix4`.
|
|
280
|
-
*/
|
|
281
|
-
export declare function toObject(m: Matrix4): Matrix4AsObject;
|
|
282
|
-
/**
|
|
283
|
-
* A type guard to check if `obj` is of type `Matrix4`.
|
|
284
|
-
*/
|
|
285
|
-
export declare function isType(obj: unknown): obj is Matrix4;
|
package/dist/cdn/plane.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as Line3 from './line3';
|
|
2
|
-
import * as Vector3 from './vector3';
|
|
3
|
-
/**
|
|
4
|
-
* A two dimensional surface in 3D space that extends indefinitely. Represented
|
|
5
|
-
* as a direction normal and distance.
|
|
6
|
-
*/
|
|
7
|
-
export interface Plane {
|
|
8
|
-
normal: Vector3.Vector3;
|
|
9
|
-
constant: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new plane. Defaults to a normal of `[0,0,0]` and constant of `0`.
|
|
13
|
-
*
|
|
14
|
-
* @param values Values to assign to the plane.
|
|
15
|
-
* @returns A new plane.
|
|
16
|
-
*/
|
|
17
|
-
export declare function create(values?: Partial<Plane>): Plane;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a plane from a normal and an arbitrary point on a plane.
|
|
20
|
-
*
|
|
21
|
-
* @param normal A normal.
|
|
22
|
-
* @param point A point on the plane.
|
|
23
|
-
* @returns A new plane.
|
|
24
|
-
*/
|
|
25
|
-
export declare function fromNormalAndCoplanarPoint(normal: Vector3.Vector3, point: Vector3.Vector3): Plane;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the perpendicular distance from the plane to the given point.
|
|
28
|
-
*
|
|
29
|
-
* @param plane The plane.
|
|
30
|
-
* @param point The point to calculate distance from `plane`.
|
|
31
|
-
* @returns A distance.
|
|
32
|
-
*/
|
|
33
|
-
export declare function distanceToPoint(plane: Plane, point: Vector3.Vector3): number;
|
|
34
|
-
/**
|
|
35
|
-
* Returns the point where the line intersects with this plane. If the line does
|
|
36
|
-
* not intersect, then `undefined` is returned. If the line is on the plane,
|
|
37
|
-
* then the starting point of the line is returned.
|
|
38
|
-
*
|
|
39
|
-
* @param plane The plane to intersect.
|
|
40
|
-
* @param line The line to intersect.
|
|
41
|
-
* @returns An intersecting point on the plane and line.
|
|
42
|
-
*/
|
|
43
|
-
export declare function intersectLine(plane: Plane, line: Line3.Line3): Vector3.Vector3 | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Projects the given `point` onto the given `plane`.
|
|
46
|
-
*
|
|
47
|
-
* @param plane The plane to project onto.
|
|
48
|
-
* @param point The point to project.
|
|
49
|
-
* @returns The projected point.
|
|
50
|
-
*/
|
|
51
|
-
export declare function projectPoint(plane: Plane, point: Vector3.Vector3): Vector3.Vector3;
|
package/dist/cdn/point.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import * as Angle from './angle';
|
|
2
|
-
/**
|
|
3
|
-
* A `Point` represents a cartesian coordinate with a horizontal and vertical
|
|
4
|
-
* position or length.
|
|
5
|
-
*/
|
|
6
|
-
export interface Point {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Returns a new `Point` with the given horizontal and vertical position.
|
|
12
|
-
*/
|
|
13
|
-
export declare function create(x?: number, y?: number): Point;
|
|
14
|
-
/**
|
|
15
|
-
* Converts a polar coordinate (length and angle) into a Cartesian coordinate.
|
|
16
|
-
*/
|
|
17
|
-
export declare function polar(length: number, radians: Angle.Angle): Point;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the distance between two points.
|
|
20
|
-
*/
|
|
21
|
-
export declare function distance(a: Point, b: Point): number;
|
|
22
|
-
/**
|
|
23
|
-
* Returns a new `Point` where `b` is subtracted from `a`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function subtract(a: Point, b: Point): Point;
|
|
26
|
-
/**
|
|
27
|
-
* Returns a new `Point` where `b` is added to `a`.
|
|
28
|
-
*/
|
|
29
|
-
export declare function add(a: Point, b: Point): Point;
|
|
30
|
-
/**
|
|
31
|
-
* Returns `true` if the `x` and `y` positions of `a` and `b` are equal.
|
|
32
|
-
*/
|
|
33
|
-
export declare function isEqual(a: Point, b: Point): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Performs a linear interpolation between `a` and `b` and returns the result.
|
|
36
|
-
* The value of `t` is clamped between `[0, 1]`.
|
|
37
|
-
*
|
|
38
|
-
* @param a The start value.
|
|
39
|
-
* @param b The end value.
|
|
40
|
-
* @param t A value between 0 and 1.
|
|
41
|
-
* @returns A point between `a` and `b`.
|
|
42
|
-
*/
|
|
43
|
-
export declare function lerp(a: Point, b: Point, t: number): Point;
|
|
44
|
-
/**
|
|
45
|
-
* Returns a new `Point` where `x` and `y` are inverted.
|
|
46
|
-
*/
|
|
47
|
-
export declare function negate(pt: Point): Point;
|
|
48
|
-
/**
|
|
49
|
-
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
50
|
-
* factors.
|
|
51
|
-
*/
|
|
52
|
-
export declare function scale(pt: Point, scaleX: number, scaleY: number): Point;
|
|
53
|
-
/**
|
|
54
|
-
* Returns a new `Point` where `x` and `y` are multiplied by the given scale
|
|
55
|
-
* factor.
|
|
56
|
-
*/
|
|
57
|
-
export declare function scaleProportional(pt: Point, scale: number): Point;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the magnitude of a point.
|
|
60
|
-
*/
|
|
61
|
-
export declare function magnitude(pt: Point): number;
|
|
62
|
-
/**
|
|
63
|
-
* Transforms a vector into the corresponding normal (unit) vector.
|
|
64
|
-
*/
|
|
65
|
-
export declare function normalizeVector(pt: Point): Point;
|
|
66
|
-
/**
|
|
67
|
-
* Returns a new normal (unit) vector pointing between the two given points.
|
|
68
|
-
*/
|
|
69
|
-
export declare function normalDirectionVector(ptA: Point, ptB: Point): Point;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a vector orthogonal to the vector between the two given points.
|
|
72
|
-
*/
|
|
73
|
-
export declare function orthogonalVector(ptA: Point, ptB: Point): Point;
|
|
74
|
-
/**
|
|
75
|
-
* Parses a JSON string representation of a Point and returns an object.
|
|
76
|
-
*
|
|
77
|
-
* @param json A JSON string, either in the form `[x,y]` or `{"x": 0, "y": 0}`
|
|
78
|
-
* @returns A parsed Point.
|
|
79
|
-
*/
|
|
80
|
-
export declare function fromJson(json: string): Point;
|
package/dist/cdn/quaternion.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as Euler from './euler';
|
|
2
|
-
import * as Matrix4 from './matrix4';
|
|
3
|
-
import * as Vector3 from './vector3';
|
|
4
|
-
/**
|
|
5
|
-
* A type that represents a
|
|
6
|
-
* [quaternion](http://en.wikipedia.org/wiki/Quaternion). Quaternions are used
|
|
7
|
-
* in 3D graphics to represent
|
|
8
|
-
* [rotations](https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation).
|
|
9
|
-
*/
|
|
10
|
-
export interface Quaternion {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
z: number;
|
|
14
|
-
w: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* An array representation of a `Quaternion`.
|
|
18
|
-
*/
|
|
19
|
-
export declare type QuaternionAsArray = [x: number, y: number, z: number, w: number];
|
|
20
|
-
/**
|
|
21
|
-
* Returns a new quaternion. If `value` is undefined, then `{x: 0, y: 0, z: 0,
|
|
22
|
-
* w: 1}` is returned.
|
|
23
|
-
*/
|
|
24
|
-
export declare function create(value?: Partial<Quaternion>): Quaternion;
|
|
25
|
-
/**
|
|
26
|
-
* Parses a JSON string representation of a `Quaternion`.
|
|
27
|
-
*
|
|
28
|
-
* @param json A JSON string either in the form of `[x, y, z, w]` or `{"x": 0, "y": 0, "z": 0, "w": 0}`.
|
|
29
|
-
* @returns A parsed `Quaternion`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function fromJson(json: string): Quaternion;
|
|
32
|
-
/**
|
|
33
|
-
* Returns a quaternion with that will have a magnitude of 1.
|
|
34
|
-
*/
|
|
35
|
-
export declare function normalize(q: Quaternion): Quaternion;
|
|
36
|
-
/**
|
|
37
|
-
* Returns the magnitude of the provided quaternion.
|
|
38
|
-
*/
|
|
39
|
-
export declare function magnitude(q: Quaternion): number;
|
|
40
|
-
/**
|
|
41
|
-
* Returns a quaternion where each component is multiplied by the `scalar`.
|
|
42
|
-
*/
|
|
43
|
-
export declare function scale(scalar: number, q: Quaternion): Quaternion;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a `Quaternion` that is rotated the given radians around an axis.
|
|
46
|
-
*
|
|
47
|
-
* @param axis The axis to rotate around.
|
|
48
|
-
* @param radians The rotation, in radians.
|
|
49
|
-
* @returns A rotated quaternion.
|
|
50
|
-
*/
|
|
51
|
-
export declare function fromAxisAngle(axis: Vector3.Vector3, radians: number): Quaternion;
|
|
52
|
-
/**
|
|
53
|
-
* Returns a quaternion using the upper 3x3 of a pure rotation matrix
|
|
54
|
-
* (unscaled).
|
|
55
|
-
*/
|
|
56
|
-
export declare function fromMatrixRotation(matrix: Matrix4.Matrix4): Quaternion;
|
|
57
|
-
export declare function fromEuler(euler: Euler.Euler): Quaternion;
|
|
58
|
-
/**
|
|
59
|
-
* Multiplies `a` x `b` and returns a new quaternion with the result.
|
|
60
|
-
*/
|
|
61
|
-
export declare function multiply(a: Quaternion, b: Quaternion): Quaternion;
|
|
62
|
-
/**
|
|
63
|
-
* Type guard that checks if the given type is a Quaternion.
|
|
64
|
-
*/
|
|
65
|
-
export declare function isType(obj: unknown): obj is Quaternion;
|
package/dist/cdn/ray.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as Plane from './plane';
|
|
2
|
-
import * as Vector3 from './vector3';
|
|
3
|
-
/**
|
|
4
|
-
* A `Ray` represents an infinite line starting at `origin` and going in
|
|
5
|
-
* `direction`.
|
|
6
|
-
*/
|
|
7
|
-
export interface Ray {
|
|
8
|
-
/**
|
|
9
|
-
* The origin point of the ray.
|
|
10
|
-
*/
|
|
11
|
-
origin: Vector3.Vector3;
|
|
12
|
-
/**
|
|
13
|
-
* A normal that describes the direction of the ray from origin.
|
|
14
|
-
*/
|
|
15
|
-
direction: Vector3.Vector3;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new ray with the given values, or using default values if none are
|
|
19
|
-
* provided. The direction defaults to `{x: 0, y: 0, z: -1}` if undefined.
|
|
20
|
-
*
|
|
21
|
-
* @param value The values of the ray.
|
|
22
|
-
* @returns A new ray.
|
|
23
|
-
*/
|
|
24
|
-
export declare function create(value?: Partial<Ray>): Ray;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a point at the given distance along this ray.
|
|
27
|
-
*
|
|
28
|
-
* @param ray The ray to get the point on.
|
|
29
|
-
* @param distance A distance from origin along the ray's direction.
|
|
30
|
-
* @returns A point on the ray.
|
|
31
|
-
*/
|
|
32
|
-
export declare function at(ray: Ray, distance: number): Vector3.Vector3;
|
|
33
|
-
/**
|
|
34
|
-
* Computes the distance of the `ray`s origin to the given `plane`. Returns a
|
|
35
|
-
* distance of 0 if the ray is coplanar and returns `undefined` if the ray does
|
|
36
|
-
* not intersect with the plane.
|
|
37
|
-
*
|
|
38
|
-
* @param ray The ray to get the distance for.
|
|
39
|
-
* @param plane The plane to compute the distance to.
|
|
40
|
-
* @returns The distance to the plane, or `undefined` if it cannot be computed.
|
|
41
|
-
*/
|
|
42
|
-
export declare function distanceToPlane(ray: Ray, plane: Plane.Plane): number | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Computes the intersection point of the given `ray` to the given `plane`. If
|
|
45
|
-
* the ray does not intersect with the plane, then `undefined` is returned.
|
|
46
|
-
*
|
|
47
|
-
* @param ray The ray to intersect.
|
|
48
|
-
* @param plane The plane to intersect with.
|
|
49
|
-
* @returns The intersection point, or `undefined` if the ray does not
|
|
50
|
-
* intersect.
|
|
51
|
-
*/
|
|
52
|
-
export declare function intersectPlane(ray: Ray, plane: Plane.Plane): Vector3.Vector3 | undefined;
|
package/dist/cdn/rectangle.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import * as Dimensions from './dimensions';
|
|
2
|
-
import * as Point from './point';
|
|
3
|
-
/**
|
|
4
|
-
* A `Rectangle` is an object with position and size.
|
|
5
|
-
*/
|
|
6
|
-
export interface Rectangle {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns a new `Rectangle` with the given position and size.
|
|
14
|
-
*/
|
|
15
|
-
export declare function create(x: number, y: number, width: number, height: number): Rectangle;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a new `Rectangle` at the origin point and given size.
|
|
18
|
-
*/
|
|
19
|
-
export declare function fromDimensions(dimensions: Dimensions.Dimensions): Rectangle;
|
|
20
|
-
/**
|
|
21
|
-
* Returns a new `Rectangle` with the given position and size.
|
|
22
|
-
*/
|
|
23
|
-
export declare function fromPointAndDimensions(point: Point.Point, dimensions: Dimensions.Dimensions): Rectangle;
|
|
24
|
-
/**
|
|
25
|
-
* Returns a new `Rectangle` with the given top-left and bottom-right positions.
|
|
26
|
-
* The returned rectangle will always returns a positive width and height.
|
|
27
|
-
*/
|
|
28
|
-
export declare function fromPoints(topLeftPt: Point.Point, bottomRightPt: Point.Point): Rectangle;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a rectangle where the longest length of `rect` will be equal to the
|
|
31
|
-
* shortest length of `to`. The shortest length of `rect` will be proportionally
|
|
32
|
-
* scaled to match the aspect ratio of `rect`. The returned rectangle will be
|
|
33
|
-
* centered within `to`.
|
|
34
|
-
*
|
|
35
|
-
* @see {@link cropFit}
|
|
36
|
-
*/
|
|
37
|
-
export declare function containFit(to: Rectangle, rect: Rectangle): Rectangle;
|
|
38
|
-
/**
|
|
39
|
-
* Returns a rectangle where the shortest length of `rect` will be equal to the
|
|
40
|
-
* longest length of `to`. The longest length of `rect` will be proportionally
|
|
41
|
-
* scaled to match the aspect ratio of `rect`. The returned rectangle will be
|
|
42
|
-
* centered within `to`.
|
|
43
|
-
*
|
|
44
|
-
* @see {@link containFit}
|
|
45
|
-
*/
|
|
46
|
-
export declare function cropFit(to: Rectangle, rect: Rectangle): Rectangle;
|
|
47
|
-
/**
|
|
48
|
-
* Returns a rectangle where each side of `rect` will be reduced proportionally
|
|
49
|
-
* to have an area less than or equal to the provided `to` value. The returned
|
|
50
|
-
* rectangle will be centered within the original bounds of `rect`.
|
|
51
|
-
*
|
|
52
|
-
* @param to - the maximum area this rectangle can have
|
|
53
|
-
* @param rect - the rectangle to scale to fit the specified area
|
|
54
|
-
*/
|
|
55
|
-
export declare function scaleFit(to: number, rect: Rectangle): Rectangle;
|
|
56
|
-
/**
|
|
57
|
-
* Returns a rectangle where the position and dimensions are scaled by the given
|
|
58
|
-
* factors. If `scaleY` is omitted, then the position and dimensions are scaled
|
|
59
|
-
* uniformly by `scaleOrScaleX`.
|
|
60
|
-
*
|
|
61
|
-
* @param rect The rectangle to scale.
|
|
62
|
-
* @param scaleOrScaleX The uniform scale factor, or the horizontal scale
|
|
63
|
-
* factor.
|
|
64
|
-
* @param scaleY The vertical scale factor.
|
|
65
|
-
* @returns A scaled rectangle.
|
|
66
|
-
*/
|
|
67
|
-
export declare function scale(rect: Rectangle, scaleOrScaleX: number, scaleY?: number): Rectangle;
|
|
68
|
-
/**
|
|
69
|
-
* Returns true if two rectangles are equal in position and size.
|
|
70
|
-
*/
|
|
71
|
-
export declare function isEqual(a: Rectangle, b: Rectangle): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Returns a rectangle that has its position shifted by a given offset. The
|
|
74
|
-
* size of the rectangle is unchanged.
|
|
75
|
-
*/
|
|
76
|
-
export declare function offset(delta: Point.Point, rect: Rectangle): Rectangle;
|
|
77
|
-
/**
|
|
78
|
-
* Returns the area of the rectangle.
|
|
79
|
-
*/
|
|
80
|
-
export declare function area(rect: Rectangle): number;
|
|
81
|
-
/**
|
|
82
|
-
* Returns the center point of the rectangle.
|
|
83
|
-
*/
|
|
84
|
-
export declare function center(rect: Rectangle): Point.Point;
|
|
85
|
-
/**
|
|
86
|
-
* Returns the top-left position of the rectangle, as a point.
|
|
87
|
-
*/
|
|
88
|
-
export declare function topLeft(rect: Rectangle): Point.Point;
|
|
89
|
-
/**
|
|
90
|
-
* Returns the bottom-right position of the rectangle, as a point.
|
|
91
|
-
*/
|
|
92
|
-
export declare function bottomRight(rect: Rectangle): Point.Point;
|
|
93
|
-
/**
|
|
94
|
-
* Returns `true` if the given rectangle has a portrait aspect ratio.
|
|
95
|
-
*/
|
|
96
|
-
export declare function isPortrait(rect: Rectangle): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Returns `true` if the given rectangle has a landscape aspect ratio.
|
|
99
|
-
*/
|
|
100
|
-
export declare function isLandscape(rect: Rectangle): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Returns `true` if the given rectangle has a square aspect ratio.
|
|
103
|
-
*/
|
|
104
|
-
export declare function isSquare(rect: Rectangle): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Pads a rectangle by the given amount, maintaining the center position.
|
|
107
|
-
*
|
|
108
|
-
* @param rect The rectangle to apply padding to.
|
|
109
|
-
* @param padding The padding to add.
|
|
110
|
-
*/
|
|
111
|
-
export declare function pad(rect: Rectangle, padding: number): Rectangle;
|
|
112
|
-
/**
|
|
113
|
-
* Returns `true` if the given rectangle contains all the given `points`.
|
|
114
|
-
*
|
|
115
|
-
* @param rect The rectangle to check against.
|
|
116
|
-
* @param points The points to check.
|
|
117
|
-
*/
|
|
118
|
-
export declare function containsPoints(rect: Rectangle, ...points: Point.Point[]): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Parses a JSON string representation of a Rectangle and returns an object.
|
|
121
|
-
*
|
|
122
|
-
* @param json A JSON string, either in the form `[x,y,width,height]` or `{"x": 0, "y": 0, "width": 10, "height": 10}`
|
|
123
|
-
* @returns A parsed Point.
|
|
124
|
-
*/
|
|
125
|
-
export declare function fromJson(json: string): Rectangle;
|