Skip to content

Commit ceedcce

Browse files
committed
archive 2.x
1 parent 0901809 commit ceedcce

36 files changed

+19479
-0
lines changed

dist/2.x/mat3-impl.d.ts

+271
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
import { Quat } from './quat';
2+
import { Mat3 } from './mat3';
3+
import { Mat4 } from './mat4';
4+
import Vec2 from './vec2-impl';
5+
export default Mat3;
6+
export type Mat3LikeCtor = new (n: number) => Mat3;
7+
/**
8+
* Sets the type this library creates for a Mat3
9+
* @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`
10+
* @returns previous constructor for Mat3
11+
*/
12+
export declare function setDefaultType(ctor: new (n: number) => Mat3): Mat3LikeCtor;
13+
/**
14+
* Create a Mat3 from values
15+
*
16+
* Note: Since passing in a raw JavaScript array
17+
* is valid in all circumstances, if you want to
18+
* force a JavaScript array into a Mat3's specified type
19+
* it would be faster to use
20+
*
21+
* ```
22+
* const m = mat3.clone(someJSArray);
23+
* ```
24+
*
25+
* Note: a consequence of the implementation is if your Mat3Type = `Array`
26+
* instead of `Float32Array` or `Float64Array` then any values you
27+
* don't pass in will be undefined. Usually this is not an issue since
28+
* (a) using `Array` is rare and (b) using `mat3.create` is usually used
29+
* to create a Mat3 to be filled out as in
30+
*
31+
* ```
32+
* const m = mat3.create();
33+
* mat3.perspective(fov, aspect, near, far, m);
34+
* ```
35+
*
36+
* @param v0 - value for element 0
37+
* @param v1 - value for element 1
38+
* @param v2 - value for element 2
39+
* @param v3 - value for element 3
40+
* @param v4 - value for element 4
41+
* @param v5 - value for element 5
42+
* @param v6 - value for element 6
43+
* @param v7 - value for element 7
44+
* @param v8 - value for element 8
45+
* @returns matrix created from values.
46+
*/
47+
export declare function create(v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number, v8?: number): Mat3;
48+
/**
49+
* Sets the values of a Mat3
50+
* Also see {@link mat3.create} and {@link mat3.copy}
51+
*
52+
* @param v0 - value for element 0
53+
* @param v1 - value for element 1
54+
* @param v2 - value for element 2
55+
* @param v3 - value for element 3
56+
* @param v4 - value for element 4
57+
* @param v5 - value for element 5
58+
* @param v6 - value for element 6
59+
* @param v7 - value for element 7
60+
* @param v8 - value for element 8
61+
* @param dst - matrix to hold result. If not passed a new one is created.
62+
* @returns Mat3 set from values.
63+
*/
64+
export declare function set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, dst?: Mat3): Mat3;
65+
/**
66+
* Creates a Mat3 from the upper left 3x3 part of a Mat4
67+
* @param m4 - source matrix
68+
* @param dst - matrix to hold result. If not passed a new one is created.
69+
* @returns Mat3 made from m4
70+
*/
71+
export declare function fromMat4(m4: Mat4, dst?: Mat3): Mat3;
72+
/**
73+
* Creates a Mat3 rotation matrix from a quaternion
74+
* @param q - quaternion to create matrix from
75+
* @param dst - matrix to hold result. If not passed a new one is created.
76+
* @returns Mat3 made from q
77+
*/
78+
export declare function fromQuat(q: Quat, dst?: Mat3): Mat3;
79+
/**
80+
* Negates a matrix.
81+
* @param m - The matrix.
82+
* @param dst - matrix to hold result. If not passed a new one is created.
83+
* @returns -m.
84+
*/
85+
export declare function negate(m: Mat3, dst?: Mat3): Mat3;
86+
/**
87+
* Copies a matrix. (same as {@link mat3.clone})
88+
* Also see {@link mat3.create} and {@link mat3.set}
89+
* @param m - The matrix.
90+
* @param dst - The matrix. If not passed a new one is created.
91+
* @returns A copy of m.
92+
*/
93+
export declare function copy(m: Mat3, dst?: Mat3): Mat3;
94+
/**
95+
* Copies a matrix (same as {@link mat3.copy})
96+
* Also see {@link mat3.create} and {@link mat3.set}
97+
* @param m - The matrix.
98+
* @param dst - The matrix. If not passed a new one is created.
99+
* @returns A copy of m.
100+
*/
101+
export declare const clone: typeof copy;
102+
/**
103+
* Check if 2 matrices are approximately equal
104+
* @param a Operand matrix.
105+
* @param b Operand matrix.
106+
* @returns true if matrices are approximately equal
107+
*/
108+
export declare function equalsApproximately(a: Mat3, b: Mat3): boolean;
109+
/**
110+
* Check if 2 matrices are exactly equal
111+
* @param a Operand matrix.
112+
* @param b Operand matrix.
113+
* @returns true if matrices are exactly equal
114+
*/
115+
export declare function equals(a: Mat3, b: Mat3): boolean;
116+
/**
117+
* Creates a 3-by-3 identity matrix.
118+
*
119+
* @param dst - matrix to hold result. If not passed a new one is created.
120+
* @returns A 3-by-3 identity matrix.
121+
*/
122+
export declare function identity(dst?: Mat3): Mat3;
123+
/**
124+
* Takes the transpose of a matrix.
125+
* @param m - The matrix.
126+
* @param dst - matrix to hold result. If not passed a new one is created.
127+
* @returns The transpose of m.
128+
*/
129+
export declare function transpose(m: Mat3, dst?: Mat3): Mat3;
130+
/**
131+
* Computes the inverse of a 3-by-3 matrix.
132+
* @param m - The matrix.
133+
* @param dst - matrix to hold result. If not passed a new one is created.
134+
* @returns The inverse of m.
135+
*/
136+
export declare function inverse(m: Mat3, dst?: Mat3): Mat3;
137+
/**
138+
* Compute the determinant of a matrix
139+
* @param m - the matrix
140+
* @returns the determinant
141+
*/
142+
export declare function determinant(m: Mat3): number;
143+
/**
144+
* Computes the inverse of a 3-by-3 matrix. (same as inverse)
145+
* @param m - The matrix.
146+
* @param dst - matrix to hold result. If not passed a new one is created.
147+
* @returns The inverse of m.
148+
*/
149+
export declare const invert: typeof inverse;
150+
/**
151+
* Multiplies two 3-by-3 matrices with a on the left and b on the right
152+
* @param a - The matrix on the left.
153+
* @param b - The matrix on the right.
154+
* @param dst - matrix to hold result. If not passed a new one is created.
155+
* @returns The matrix product of a and b.
156+
*/
157+
export declare function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3;
158+
/**
159+
* Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)
160+
* @param a - The matrix on the left.
161+
* @param b - The matrix on the right.
162+
* @param dst - matrix to hold result. If not passed a new one is created.
163+
* @returns The matrix product of a and b.
164+
*/
165+
export declare const mul: typeof multiply;
166+
/**
167+
* Sets the translation component of a 3-by-3 matrix to the given
168+
* vector.
169+
* @param a - The matrix.
170+
* @param v - The vector.
171+
* @param dst - matrix to hold result. If not passed a new one is created.
172+
* @returns The matrix with translation set.
173+
*/
174+
export declare function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3;
175+
/**
176+
* Returns the translation component of a 3-by-3 matrix as a vector with 3
177+
* entries.
178+
* @param m - The matrix.
179+
* @param dst - vector to hold result. If not passed a new one is created.
180+
* @returns The translation component of m.
181+
*/
182+
export declare function getTranslation(m: Mat3, dst?: Vec2): Vec2;
183+
/**
184+
* Returns an axis of a 3x3 matrix as a vector with 2 entries
185+
* @param m - The matrix.
186+
* @param axis - The axis 0 = x, 1 = y,
187+
* @returns The axis component of m.
188+
*/
189+
export declare function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2;
190+
/**
191+
* Sets an axis of a 3x3 matrix as a vector with 2 entries
192+
* @param m - The matrix.
193+
* @param v - the axis vector
194+
* @param axis - The axis 0 = x, 1 = y;
195+
* @param dst - The matrix to set. If not passed a new one is created.
196+
* @returns The matrix with axis set.
197+
*/
198+
export declare function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3;
199+
/**
200+
* Returns the scaling component of the matrix
201+
* @param m - The Matrix
202+
* @param dst - The vector to set. If not passed a new one is created.
203+
*/
204+
export declare function getScaling(m: Mat3, dst?: Vec2): Vec2;
205+
/**
206+
* Creates a 3-by-3 matrix which translates by the given vector v.
207+
* @param v - The vector by which to translate.
208+
* @param dst - matrix to hold result. If not passed a new one is created.
209+
* @returns The translation matrix.
210+
*/
211+
export declare function translation(v: Vec2, dst?: Mat3): Mat3;
212+
/**
213+
* Translates the given 3-by-3 matrix by the given vector v.
214+
* @param m - The matrix.
215+
* @param v - The vector by which to translate.
216+
* @param dst - matrix to hold result. If not passed a new one is created.
217+
* @returns The translated matrix.
218+
*/
219+
export declare function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3;
220+
/**
221+
* Creates a 3-by-3 matrix which rotates by the given angle.
222+
* @param angleInRadians - The angle by which to rotate (in radians).
223+
* @param dst - matrix to hold result. If not passed a new one is created.
224+
* @returns The rotation matrix.
225+
*/
226+
export declare function rotation(angleInRadians: number, dst?: Mat3): Mat3;
227+
/**
228+
* Rotates the given 3-by-3 matrix by the given angle.
229+
* @param m - The matrix.
230+
* @param angleInRadians - The angle by which to rotate (in radians).
231+
* @param dst - matrix to hold result. If not passed a new one is created.
232+
* @returns The rotated matrix.
233+
*/
234+
export declare function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3;
235+
/**
236+
* Creates a 3-by-3 matrix which scales in each dimension by an amount given by
237+
* the corresponding entry in the given vector; assumes the vector has three
238+
* entries.
239+
* @param v - A vector of
240+
* 2 entries specifying the factor by which to scale in each dimension.
241+
* @param dst - matrix to hold result. If not passed a new one is created.
242+
* @returns The scaling matrix.
243+
*/
244+
export declare function scaling(v: Vec2, dst?: Mat3): Mat3;
245+
/**
246+
* Scales the given 3-by-3 matrix in each dimension by an amount
247+
* given by the corresponding entry in the given vector; assumes the vector has
248+
* three entries.
249+
* @param m - The matrix to be modified.
250+
* @param v - A vector of 2 entries specifying the
251+
* factor by which to scale in each dimension.
252+
* @param dst - matrix to hold result. If not passed a new one is created.
253+
* @returns The scaled matrix.
254+
*/
255+
export declare function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3;
256+
/**
257+
* Creates a 3-by-3 matrix which scales uniformly in each dimension
258+
* @param s - Amount to scale
259+
* @param dst - matrix to hold result. If not passed a new one is created.
260+
* @returns The scaling matrix.
261+
*/
262+
export declare function uniformScaling(s: number, dst?: Mat3): Mat3;
263+
/**
264+
* Scales the given 3-by-3 matrix in each dimension by an amount
265+
* given.
266+
* @param m - The matrix to be modified.
267+
* @param s - Amount to scale.
268+
* @param dst - matrix to hold result. If not passed a new one is created.
269+
* @returns The scaled matrix.
270+
*/
271+
export declare function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3;

0 commit comments

Comments
 (0)