@vertexvis/geometry 1.0.2-canary.7 → 1.0.2-canary.9
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/bundle.cjs +166 -149
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.js +166 -149
- package/dist/bundle.js.map +1 -1
- package/dist/cdn/bundle.js +166 -149
- package/dist/cdn/bundle.js.map +1 -1
- package/dist/cdn/bundle.min.js +1 -1
- package/dist/cdn/bundle.min.js.map +1 -1
- package/dist/euler.d.ts +1 -1
- package/dist/matrix4.d.ts +33 -25
- package/dist/vector3.d.ts +17 -1
- package/package.json +3 -3
package/dist/matrix4.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as Quaternion from './quaternion';
|
|
2
2
|
import * as Vector3 from './vector3';
|
|
3
3
|
/**
|
|
4
|
-
* A type alias representing a 4x4
|
|
4
|
+
* A type alias representing a 4x4 row-major matrix.
|
|
5
5
|
*
|
|
6
6
|
* The common use-case for 4x4 matrices in 3D computer graphics are for
|
|
7
|
-
* [transformation
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* as translation, rotation and scale.
|
|
7
|
+
* [transformation matrices](https://en.wikipedia.org/wiki/Transformation_matrix).
|
|
8
|
+
* This allows a point in 3D space to be projected onto a 2D screen using
|
|
9
|
+
* transformations such as translation, rotation and scale.
|
|
11
10
|
*/
|
|
12
11
|
export type Matrix4 = [
|
|
13
12
|
number,
|
|
@@ -117,12 +116,12 @@ export declare function makeRotation(rotation: Quaternion.Quaternion): Matrix4;
|
|
|
117
116
|
*/
|
|
118
117
|
export declare function makeScale(scale: Vector3.Vector3): Matrix4;
|
|
119
118
|
/**
|
|
120
|
-
* Creates a matrix that has translation, rotation and scale applied to it.
|
|
119
|
+
* Creates a matrix that has translation, rotation, and scale applied to it.
|
|
121
120
|
*
|
|
122
121
|
* @param translation The translation applied to the matrix.
|
|
123
122
|
* @param rotation The rotation applied to the matrix.
|
|
124
123
|
* @param scale The scale applied to the matrix.
|
|
125
|
-
* @returns A transformed matrix.
|
|
124
|
+
* @returns A transformed matrix in column-major form.
|
|
126
125
|
*/
|
|
127
126
|
export declare function makeTRS(translation: Vector3.Vector3, rotation: Quaternion.Quaternion, scale: Vector3.Vector3): Matrix4;
|
|
128
127
|
/**
|
|
@@ -130,27 +129,18 @@ export declare function makeTRS(translation: Vector3.Vector3, rotation: Quaterni
|
|
|
130
129
|
* the following x, y, and z axis.
|
|
131
130
|
*
|
|
132
131
|
* ```
|
|
133
|
-
* x.x y.
|
|
134
|
-
* x.y y.
|
|
135
|
-
* x.
|
|
132
|
+
* x.x x.y x.z 0
|
|
133
|
+
* y.x y.y y.z 0
|
|
134
|
+
* z.x z.y z.z 0
|
|
136
135
|
* 0 0 0 0
|
|
137
136
|
* ```
|
|
138
137
|
*
|
|
139
|
-
* @param x The x
|
|
140
|
-
* @param y The y
|
|
141
|
-
* @param z The z
|
|
138
|
+
* @param x The x-axis to set.
|
|
139
|
+
* @param y The y-axis to set.
|
|
140
|
+
* @param z The z-axis to set.
|
|
142
141
|
* @returns A matrix with its basis components populated.
|
|
143
142
|
*/
|
|
144
143
|
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
144
|
/**
|
|
155
145
|
* Creates a matrix used for [perspective
|
|
156
146
|
* projections](https://en.wikipedia.org/wiki/3D_projection#Perspective_projection).
|
|
@@ -258,7 +248,7 @@ export declare function invert(matrix: Matrix4): Matrix4;
|
|
|
258
248
|
*/
|
|
259
249
|
export declare function lookAt(m: Matrix4, position: Vector3.Vector3, target: Vector3.Vector3, up: Vector3.Vector3): Matrix4;
|
|
260
250
|
/**
|
|
261
|
-
* Returns a post-multiplied matrix.
|
|
251
|
+
* Returns a post-multiplied matrix equal to ab.
|
|
262
252
|
*/
|
|
263
253
|
export declare function multiply(a: Matrix4, b: Matrix4): Matrix4;
|
|
264
254
|
/**
|
|
@@ -267,18 +257,36 @@ export declare function multiply(a: Matrix4, b: Matrix4): Matrix4;
|
|
|
267
257
|
*/
|
|
268
258
|
export declare function transpose(matrix: Matrix4): Matrix4;
|
|
269
259
|
/**
|
|
270
|
-
* Multiplies the columns of a matrix by the given vector.
|
|
260
|
+
* Multiplies the columns of a row-major matrix by the given vector.
|
|
271
261
|
*/
|
|
272
262
|
export declare function scale(matrix: Matrix4, scale: Vector3.Vector3): Matrix4;
|
|
273
|
-
|
|
263
|
+
/**
|
|
264
|
+
* Sets the position of the matrix given as the first parameter
|
|
265
|
+
* to the position of the matrix given as the second parameter.
|
|
266
|
+
* Both matrices should have row-major format.
|
|
267
|
+
*/
|
|
268
|
+
export declare function position(originalMatrix: Matrix4, matrixWithDesiredPosition: Matrix4): Matrix4;
|
|
274
269
|
/**
|
|
275
270
|
* Returns true if the matrix is an identity matrix.
|
|
276
271
|
*/
|
|
277
272
|
export declare function isIdentity(matrix: Matrix4): boolean;
|
|
278
273
|
/**
|
|
279
274
|
* Returns an object representation of a `Matrix4`.
|
|
275
|
+
* @param m A Matrix4 item written in column-major form.
|
|
276
|
+
*
|
|
277
|
+
* @deprecated Use {@link toObjectColumnMajor} or {@link toObjectRowMajor} instead.
|
|
280
278
|
*/
|
|
281
279
|
export declare function toObject(m: Matrix4): Matrix4AsObject;
|
|
280
|
+
/**
|
|
281
|
+
* Returns an object representation of a `Matrix4`.
|
|
282
|
+
* @param m A Matrix4 item written in column-major form.
|
|
283
|
+
*/
|
|
284
|
+
export declare function toObjectColumnMajor(m: Matrix4): Matrix4AsObject;
|
|
285
|
+
/**
|
|
286
|
+
* Returns an object representation of a `Matrix4`.
|
|
287
|
+
* @param m A Matrix4 item written in row-major form.
|
|
288
|
+
*/
|
|
289
|
+
export declare function toObjectRowMajor(m: Matrix4): Matrix4AsObject;
|
|
282
290
|
/**
|
|
283
291
|
* A type guard to check if `obj` is of type `Matrix4`.
|
|
284
292
|
*/
|
package/dist/vector3.d.ts
CHANGED
|
@@ -177,9 +177,25 @@ export declare function project(vector: Vector3, onNormal: Vector3): Vector3;
|
|
|
177
177
|
*/
|
|
178
178
|
export declare function rotateAboutAxis(angle: number, point: Vector3, axisDirection: Vector3, axisPosition: Vector3): Vector3;
|
|
179
179
|
/**
|
|
180
|
-
* Returns a vector that is multiplied with a matrix.
|
|
180
|
+
* Returns a vector that is multiplied with a matrix in column-major form.
|
|
181
|
+
* @param vector A Vector3 item.
|
|
182
|
+
* @param m A Matrix4 item written in column-major form.
|
|
183
|
+
*
|
|
184
|
+
* @deprecated Use {@link multiplyByTransformMatrixColumnMajor} or {@link multiplyByTransformMatrixRowMajor} instead.
|
|
181
185
|
*/
|
|
182
186
|
export declare function transformMatrix(vector: Vector3, m: Matrix4.Matrix4): Vector3;
|
|
187
|
+
/**
|
|
188
|
+
* Returns a vector that is multiplied with a matrix in column-major form.
|
|
189
|
+
* @param vector A Vector3 item.
|
|
190
|
+
* @param m A Matrix4 item written in column-major form.
|
|
191
|
+
*/
|
|
192
|
+
export declare function multiplyByTransformMatrixColumnMajor(vector: Vector3, m: Matrix4.Matrix4): Vector3;
|
|
193
|
+
/**
|
|
194
|
+
* Returns a vector that is multiplied with a matrix in row-major form.
|
|
195
|
+
* @param vector A Vector3 item.
|
|
196
|
+
* @param m A Matrix4 item written in row-major form.
|
|
197
|
+
*/
|
|
198
|
+
export declare function multiplyByTransformMatrixRowMajor(vector: Vector3, m: Matrix4.Matrix4): Vector3;
|
|
183
199
|
/**
|
|
184
200
|
* Euclidean distance between two vectors
|
|
185
201
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertexvis/geometry",
|
|
3
|
-
"version": "1.0.2-canary.
|
|
3
|
+
"version": "1.0.2-canary.9",
|
|
4
4
|
"description": "Library for 2D and 3D geometric types.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vertex Developers <support@vertex3d.com> (https://developer.vertex3d.com)",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/jest": "^29.5.14",
|
|
50
50
|
"@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
|
|
51
51
|
"@vertexvis/jest-config-vertexvis": "^0.5.4",
|
|
52
|
-
"@vertexwebsdk/build": "1.0.2-canary.
|
|
52
|
+
"@vertexwebsdk/build": "1.0.2-canary.9",
|
|
53
53
|
"eslint": "^8.57.1",
|
|
54
54
|
"jest": "^29.5.14",
|
|
55
55
|
"jest-cli": "^29.5.14",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"tslib": ">=2.4.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "366f5fddf21134632e865d3f50ea23804a54a4fa"
|
|
65
65
|
}
|