@vertexvis/geometry 0.24.5-canary.6 → 1.0.0-testing.1
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/vector3.d.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import * as Euler from './euler';
|
|
2
|
-
import * as Matrix4 from './matrix4';
|
|
3
|
-
/**
|
|
4
|
-
* A `Vector3` represents a vector of 3 dimensions values. It may represent a
|
|
5
|
-
* point or direction.
|
|
6
|
-
*/
|
|
7
|
-
export interface Vector3 {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
z: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A `Vector3` representation as an array.
|
|
14
|
-
*/
|
|
15
|
-
export declare type Vector3AsArray = [x: number, y: number, z: number];
|
|
16
|
-
/**
|
|
17
|
-
* Returns a new `Vector3` either with the provided x, y, and z dimensions,
|
|
18
|
-
* or from the provided `Partial<Vector3>` object populated with zeroes
|
|
19
|
-
* wherever a component is missing.
|
|
20
|
-
*
|
|
21
|
-
* Providing no values to this function will result in a zero-length vector.
|
|
22
|
-
*/
|
|
23
|
-
export declare function create(x: number, y: number, z: number): Vector3;
|
|
24
|
-
export declare function create(partialVector: Partial<Vector3>): Vector3;
|
|
25
|
-
export declare function create(): Vector3;
|
|
26
|
-
/**
|
|
27
|
-
* Checks if each component of the given vector is populated with a numeric
|
|
28
|
-
* component. A component is invalid if it contains a non-finite or NaN value.
|
|
29
|
-
*/
|
|
30
|
-
export declare function isValid({ x, y, z }: Vector3): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Returns a vector representing the scale elements of `matrix`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function fromMatrixScale(matrix: Matrix4.Matrix4): Vector3;
|
|
35
|
-
/**
|
|
36
|
-
* Returns a vector representing the position elements of `matrix`.
|
|
37
|
-
*/
|
|
38
|
-
export declare function fromMatrixPosition(matrix: Matrix4.Matrix4): Vector3;
|
|
39
|
-
/**
|
|
40
|
-
* Parses a JSON string representation of a Vector3 and returns an object.
|
|
41
|
-
*
|
|
42
|
-
* @param json A JSON string, either in the form `[x,y,z]` or `{"x": 0, "y": 0, "z": 0}`
|
|
43
|
-
* @returns A parsed Vector3.
|
|
44
|
-
*/
|
|
45
|
-
export declare function fromJson(json: string): Vector3;
|
|
46
|
-
/**
|
|
47
|
-
* Creates a `Vector3` from an array. Pass `offset` to read values from the
|
|
48
|
-
* starting index.
|
|
49
|
-
*
|
|
50
|
-
* @see #toArray()
|
|
51
|
-
* @see #create()
|
|
52
|
-
*/
|
|
53
|
-
export declare function fromArray(nums: number[], offset?: number): Vector3;
|
|
54
|
-
/**
|
|
55
|
-
* Converts a Vector3 to an array where the values of the vector will be
|
|
56
|
-
* represented as [x, y, z];
|
|
57
|
-
*
|
|
58
|
-
* @see #fromArray()
|
|
59
|
-
* @see #create()
|
|
60
|
-
*/
|
|
61
|
-
export declare function toArray({ x, y, z }: Vector3): Vector3AsArray;
|
|
62
|
-
/**
|
|
63
|
-
* Returns a directional vector on the positive x axis, Vector3(1, 0, 0).
|
|
64
|
-
*/
|
|
65
|
-
export declare function right(): Vector3;
|
|
66
|
-
/**
|
|
67
|
-
* Returns a directional vector on the positive y axis, Vector3(0, 1, 0).
|
|
68
|
-
*/
|
|
69
|
-
export declare function up(): Vector3;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a directional vector on the positive z axis, Vector3(0, 0, -1).
|
|
72
|
-
*/
|
|
73
|
-
export declare function forward(): Vector3;
|
|
74
|
-
/**
|
|
75
|
-
* Returns a directional vector on the negative x axis, Vector3(-1, 0, 0).
|
|
76
|
-
*/
|
|
77
|
-
export declare function left(): Vector3;
|
|
78
|
-
/**
|
|
79
|
-
* Returns a directional vector on the negative y axis, Vector3(0, -1, 0).
|
|
80
|
-
*/
|
|
81
|
-
export declare function down(): Vector3;
|
|
82
|
-
/**
|
|
83
|
-
* Returns a directional vector on the negative z axis, Vector3(0, 0, 1).
|
|
84
|
-
*/
|
|
85
|
-
export declare function back(): Vector3;
|
|
86
|
-
/**
|
|
87
|
-
* Returns a vector at the origin, Vector3(0, 0, 0).
|
|
88
|
-
*/
|
|
89
|
-
export declare function origin(): Vector3;
|
|
90
|
-
/**
|
|
91
|
-
* Returns a vector with that will have a magnitude of 1.
|
|
92
|
-
*/
|
|
93
|
-
export declare function normalize(vector: Vector3): Vector3;
|
|
94
|
-
/**
|
|
95
|
-
* Returns the straight-line length from (0, 0, 0) to the given vector.
|
|
96
|
-
*/
|
|
97
|
-
export declare function magnitude(vector: Vector3): number;
|
|
98
|
-
/**
|
|
99
|
-
* Returns the straight-line length from (0, 0, 0) to the given vector).
|
|
100
|
-
*
|
|
101
|
-
* When comparing lengths of vectors, you should use this function as it's
|
|
102
|
-
* slightly more efficient to calculate.
|
|
103
|
-
*/
|
|
104
|
-
export declare function magnitudeSquared(vector: Vector3): number;
|
|
105
|
-
/**
|
|
106
|
-
* Returns a vector that is the cross product of two vectors.
|
|
107
|
-
*
|
|
108
|
-
* The cross product of two vectors results in a third vector which is
|
|
109
|
-
* perpendicular to the two input vectors. The result's magnitude is equal to
|
|
110
|
-
* the magnitudes of the two inputs multiplied together and then multiplied by
|
|
111
|
-
* the sine of the angle between the inputs. You can determine the direction of
|
|
112
|
-
* the result vector using the "left hand rule".
|
|
113
|
-
*/
|
|
114
|
-
export declare function cross(a: Vector3, b: Vector3): Vector3;
|
|
115
|
-
/**
|
|
116
|
-
* Returns a vector that is the sum of two vectors.
|
|
117
|
-
*/
|
|
118
|
-
export declare function add(a: Vector3, ...vectors: Vector3[]): Vector3;
|
|
119
|
-
/**
|
|
120
|
-
* Returns a vector that is the difference between two vectors.
|
|
121
|
-
*/
|
|
122
|
-
export declare function subtract(a: Vector3, ...vectors: Vector3[]): Vector3;
|
|
123
|
-
/**
|
|
124
|
-
* Returns a vector that where each component of `b` is multiplied with `a`.
|
|
125
|
-
*/
|
|
126
|
-
export declare function multiply(a: Vector3, b: Vector3): Vector3;
|
|
127
|
-
/**
|
|
128
|
-
* Returns a vector where each value of a vector is multiplied by the `scalar`.
|
|
129
|
-
*/
|
|
130
|
-
export declare function scale(scalar: number, vector: Vector3): Vector3;
|
|
131
|
-
/**
|
|
132
|
-
* Returns a value representing the dot product of two vectors.
|
|
133
|
-
*
|
|
134
|
-
* The dot product is a float value equal to the magnitudes of the two vectors
|
|
135
|
-
* multiplied together and then multiplied by the cosine of the angle between
|
|
136
|
-
* them.
|
|
137
|
-
*/
|
|
138
|
-
export declare function dot(a: Vector3, b: Vector3): number;
|
|
139
|
-
/**
|
|
140
|
-
* Returns the angle, in radians, between two vectors.
|
|
141
|
-
*
|
|
142
|
-
* The angle returned is the unsigned angle between the two vectors. This means
|
|
143
|
-
* the smaller of the two possible angles between the two vectors is used. The
|
|
144
|
-
* result is never greater than 180 degrees.
|
|
145
|
-
*/
|
|
146
|
-
export declare function angleTo(a: Vector3, b: Vector3): number;
|
|
147
|
-
/**
|
|
148
|
-
* Returns the Euler angle, in radians with the `xyz` ordering, between two vectors.
|
|
149
|
-
*
|
|
150
|
-
* This method will normalize both vectors for the calculation, and uses the
|
|
151
|
-
* algorithm described in https://www.xarg.org/proof/quaternion-from-two-vectors/.
|
|
152
|
-
*/
|
|
153
|
-
export declare function eulerTo(a: Vector3, b: Vector3): Euler.Euler;
|
|
154
|
-
/**
|
|
155
|
-
* Performs a projection of a `vector` onto `onNormal`.
|
|
156
|
-
*
|
|
157
|
-
* A projection is represented as the nearest point along a normal to a vector,
|
|
158
|
-
* which constructs a triangle from the origin, to the vector, to the projected
|
|
159
|
-
* point.
|
|
160
|
-
*
|
|
161
|
-
* ```
|
|
162
|
-
* Vector --> * * <-- Projected
|
|
163
|
-
* \
|
|
164
|
-
* \ | <-- Normal
|
|
165
|
-
* \|
|
|
166
|
-
* * <-- Origin
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
export declare function project(vector: Vector3, onNormal: Vector3): Vector3;
|
|
170
|
-
/**
|
|
171
|
-
* Returns a vector that is rotated about an origin point.
|
|
172
|
-
*
|
|
173
|
-
* @param angle The angle to rotate, in radians.
|
|
174
|
-
* @param point The origin point to rotate around.
|
|
175
|
-
* @param axisDirection The direction used to compute the axis.
|
|
176
|
-
* @param axisPosition The point of the axis.
|
|
177
|
-
*/
|
|
178
|
-
export declare function rotateAboutAxis(angle: number, point: Vector3, axisDirection: Vector3, axisPosition: Vector3): Vector3;
|
|
179
|
-
/**
|
|
180
|
-
* Returns a vector that is multiplied with a matrix.
|
|
181
|
-
*/
|
|
182
|
-
export declare function transformMatrix(vector: Vector3, m: Matrix4.Matrix4): Vector3;
|
|
183
|
-
/**
|
|
184
|
-
* Euclidean distance between two vectors
|
|
185
|
-
*/
|
|
186
|
-
export declare function distance(a: Vector3, b: Vector3): number;
|
|
187
|
-
/**
|
|
188
|
-
* Returns the squared distance between two vectors. If you're just comparing
|
|
189
|
-
* distances, this is slightly more efficient than `distanceTo`.
|
|
190
|
-
*/
|
|
191
|
-
export declare function distanceSquared(a: Vector3, b: Vector3): number;
|
|
192
|
-
/**
|
|
193
|
-
* Returns `true` if two vectors have the same values.
|
|
194
|
-
*/
|
|
195
|
-
export declare function isEqual(a: Vector3, b: Vector3): boolean;
|
|
196
|
-
/**
|
|
197
|
-
* Returns a vector that contains the largest components of `a` and `b`.
|
|
198
|
-
*/
|
|
199
|
-
export declare function max(a: Vector3, b: Vector3): Vector3;
|
|
200
|
-
/**
|
|
201
|
-
* Returns a vector that contains the smallest components of `a` and `b`.
|
|
202
|
-
*/
|
|
203
|
-
export declare function min(a: Vector3, b: Vector3): Vector3;
|
|
204
|
-
/**
|
|
205
|
-
* Returns a vector that each of its component negated.
|
|
206
|
-
*/
|
|
207
|
-
export declare function negate(vector: Vector3): Vector3;
|
|
208
|
-
/**
|
|
209
|
-
* Performs a linear interpolation between `a` and `b` and returns the result.
|
|
210
|
-
* The value of `t` is clamped between `[0, 1]`.
|
|
211
|
-
*
|
|
212
|
-
* @param a The start value.
|
|
213
|
-
* @param b The end value.
|
|
214
|
-
* @param t A value between 0 and 1.
|
|
215
|
-
* @returns A point between `a` and `b`.
|
|
216
|
-
*/
|
|
217
|
-
export declare function lerp(a: Vector3, b: Vector3, t: number): Vector3;
|
|
218
|
-
/**
|
|
219
|
-
* Maps a normalized device coordinate (NDC) space to world space coordinates.
|
|
220
|
-
*
|
|
221
|
-
* @param ndc A point in normalized device coordinates.
|
|
222
|
-
* @param worldMatrix A camera's world matrix.
|
|
223
|
-
* @param projectionMatrixInverse A camera's inverse projection matrix.
|
|
224
|
-
* @returns A point in world space coordinates.
|
|
225
|
-
*/
|
|
226
|
-
export declare function transformNdcToWorldSpace(ndc: Vector3, worldMatrix: Matrix4.Matrix4, projectionMatrixInverse: Matrix4.Matrix4): Vector3;
|
package/dist/cdn/vector4.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A `Vector4` represents a vector of 4 dimension values. It may represent a
|
|
3
|
-
* point or direction. It may also be used to represent a quadruplet of values,
|
|
4
|
-
* such as a row or column in a transformation matrix.
|
|
5
|
-
*/
|
|
6
|
-
export interface Vector4 {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
z: number;
|
|
10
|
-
w: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns a new Vector4. If `value` is undefined, then `{x: 0, y: 0, z: 0,
|
|
14
|
-
* w: 0}` is returned.
|
|
15
|
-
*/
|
|
16
|
-
export declare function create(value?: Partial<Vector4>): Vector4;
|
|
17
|
-
/**
|
|
18
|
-
* Parses a JSON string representation of a `Vector4`.
|
|
19
|
-
*
|
|
20
|
-
* @param json A JSON string either in the form of `[x, y, z, w]` or `{"x": 0, "y": 0, "z": 0, "w": 0}`.
|
|
21
|
-
* @returns A parsed `Vector4`.
|
|
22
|
-
*/
|
|
23
|
-
export declare function fromJson(json: string): Vector4;
|