annotate web/lib/sylvester.d.ts @ 2424:4b8f8fabeb2f

vscode settings
author drewp@bigasterisk.com
date Thu, 23 May 2024 16:40:28 -0700
parents 4556eebe5d73
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2145
cc34e9b8bb97 workaround sylvester module errors from tsc
drewp@bigasterisk.com
parents: 2144
diff changeset
1 // local fixes; the DefinitelyTyped one had "is not a module" errors
cc34e9b8bb97 workaround sylvester module errors from tsc
drewp@bigasterisk.com
parents: 2144
diff changeset
2
cc34e9b8bb97 workaround sylvester module errors from tsc
drewp@bigasterisk.com
parents: 2144
diff changeset
3
2144
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
4 // Type definitions for sylvester 0.1.3
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
5 // Project: https://github.com/jcoglan/sylvester
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
6 // Definitions by: Stephane Alie <https://github.com/StephaneAlie>
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
8
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
9 // === Sylvester ===
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
10 // Vector and Matrix mathematics modules for JavaScript
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
11 // Copyright (c) 2007 James Coglan
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
12
2145
cc34e9b8bb97 workaround sylvester module errors from tsc
drewp@bigasterisk.com
parents: 2144
diff changeset
13 export declare module Sylvester {
2144
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
14 interface VectorStatic {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
15 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
16 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
17 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
18 create(elements: Vector|Array<number>): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
19
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
20 i: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
21 j: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
22 k: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
23
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
24 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
25 * Random vector of size n.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
26 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
27 * @param {number} n The vector size.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
28 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
29 Random(n: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
30
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
31 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
32 * Vector filled with zeros.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
33 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
34 * @param {number} n The vector size.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
35 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
36 Zero(n: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
37 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
38 interface MatrixStatic {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
39 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
40 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
41 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
42 * @param {Array<number>|Array<Array<number>>|Vector|Matrix} elements The elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
43 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
44 create(elements: Array<number>|Array<Array<number>>|Vector | Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
45
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
46 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
47 * Identity matrix of size n.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
48 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
49 * @param {number} n The size.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
50 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
51 I(n: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
52
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
53 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
54 * Diagonal matrix - all off-diagonal elements are zero
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
55 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
56 * @param {any} elements The elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
57 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
58 Diagonal(elements: Array<number>|Array<Array<number>>|Vector | Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
59
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
60 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
61 * Rotation matrix about some axis. If no axis is supplied, assume we're after a 2D transform.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
62 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
63 * @param {number} theta The angle in radians.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
64 * @param {Vector} a [Optional] The axis.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
65 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
66 Rotation(theta: number, a?: Vector): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
67
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
68 RotationX(t: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
69 RotationY(t: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
70 RotationZ(t: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
71
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
72 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
73 * Random matrix of n rows, m columns.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
74 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
75 * @param {number} n The number of rows.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
76 * @param {number} m The number of columns.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
77 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
78 Random(n: number, m: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
79
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
80 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
81 * Matrix filled with zeros.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
82 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
83 * @param {number} n The number of rows.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
84 * @param {number} m The number of columns.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
85 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
86 Zero(n: number, m: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
87 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
88
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
89 interface LineStatic {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
90 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
91 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
92 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
93 * @param Array<number>|Vector anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
94 * @param Array<number>|Vector direction The direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
95 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
96 create(anchor: Array<number>|Vector, direction: Array<number>|Vector): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
97
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
98 X: Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
99 Y: Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
100 Z: Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
101 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
102 interface PlaneStatic {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
103 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
104 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
105 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
106 create(anchor: Array<number>|Vector, normal: Array<number>|Vector): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
107
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
108 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
109 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
110 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
111 create(anchor: Array<number>|Vector, v1: Array<number>|Vector, v2: Array<number>|Vector): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
112
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
113 XY: Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
114 YZ: Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
115 ZX: Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
116 YX: Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
117 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
118 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
119
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
120 interface Vector {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
121 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
122 * Gets an array containing the vector's elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
123 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
124 elements: Array<number>;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
125
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
126 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
127 * Returns element i of the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
128 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
129 e(i: number): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
130
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
131 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
132 * Returns the number of elements the vector has.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
133 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
134 dimensions(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
135
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
136 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
137 * Returns the modulus ('length') of the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
138 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
139 modulus(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
140
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
141 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
142 * Returns true if the vector is equal to the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
143 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
144 * @param {Vector|Array<number>} vector The vector to compare equality.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
145 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
146 eql(vector: Vector|Array<number>): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
147
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
148 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
149 * Returns a copy of the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
150 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
151 dup(): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
152
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
153 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
154 * Maps the vector to another vector according to the given function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
155 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
156 * @param {Function} fn The function to apply to each element (x, i) => {}.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
157 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
158 map(fn: (x: number, i: number) => any): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
159
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
160 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
161 * Calls the iterator for each element of the vector in turn.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
162 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
163 * @param {Function} fn The function to apply to each element (x, i) => {}.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
164 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
165 each(fn: (x: number, i: number) => any): void;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
166
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
167 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
168 * Returns a new vector created by normalizing the receiver.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
169 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
170 toUnitVector(): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
171
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
172 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
173 * Returns the angle between the vector and the argument (also a vector).
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
174 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
175 * @param {Vector} vector The other vector to calculate the angle.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
176 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
177 angleFrom(vector: Vector): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
178
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
179 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
180 * Returns true if the vector is parallel to the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
181 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
182 * @param {Vector} vector The other vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
183 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
184 isParallelTo(vector: Vector): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
185
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
186 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
187 * Returns true if the vector is antiparallel to the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
188 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
189 * @param {Vector} vector The other vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
190 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
191 isAntiparallelTo(vector: Vector): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
192
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
193 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
194 * Returns true iff the vector is perpendicular to the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
195 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
196 * @param {Vector} vector The other vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
197 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
198 isPerpendicularTo(vector: Vector): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
199
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
200 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
201 * Returns the result of adding the argument to the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
202 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
203 * @param {Vector|Array<number>} vector The vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
204 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
205 add(vector: Vector|Array<number>): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
206
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
207 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
208 * Returns the result of subtracting the argument from the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
209 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
210 * @param {Vector|Array<number>} vector The vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
211 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
212 subtract(vector: Vector|Array<number>): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
213
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
214 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
215 * Returns the result of multiplying the elements of the vector by the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
216 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
217 * @param {number} k The value by which to multiply the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
218 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
219 multiply(k: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
220
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
221 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
222 * Returns the result of multiplying the elements of the vector by the argument (Alias for multiply(k)).
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
223 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
224 * @param {number} k The value by which to multiply the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
225 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
226 x(k: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
227
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
228 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
229 * Returns the scalar product of the vector with the argument. Both vectors must have equal dimensionality.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
230 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
231 * @param: {Vector|Array<number>} vector The other vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
232 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
233 dot(vector: Vector|Array<number>): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
234
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
235 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
236 * Returns the vector product of the vector with the argument. Both vectors must have dimensionality 3.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
237 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
238 * @param {Vector|Array<number>} vector The other vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
239 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
240 cross(vector: Vector|Array<number>): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
241
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
242 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
243 * Returns the (absolute) largest element of the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
244 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
245 max(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
246
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
247 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
248 * Returns the index of the first match found.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
249 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
250 * @param {number} x The value.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
251 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
252 indexOf(x: number): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
253
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
254 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
255 * Returns a diagonal matrix with the vector's elements as its diagonal elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
256 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
257 toDiagonalMatrix(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
258
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
259 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
260 * Returns the result of rounding the elements of the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
261 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
262 round(): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
263
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
264 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
265 * Returns a copy of the vector with elements set to the given value if they differ from
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
266 * it by less than Sylvester.precision.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
267 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
268 * @param {number} x The value to snap to.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
269 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
270 snapTo(x: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
271
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
272 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
273 * Returns the vector's distance from the argument, when considered as a point in space.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
274 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
275 * @param {Vector|Line|Plane} obj The object to calculate the distance.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
276 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
277 distanceFrom(obj: Vector|Line|Plane): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
278
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
279 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
280 * Returns true if the vector is point on the given line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
281 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
282 * @param {Line} line The line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
283 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
284 liesOn(line: Line): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
285
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
286 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
287 * Return true if the vector is a point in the given plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
288 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
289 * @param {Plane} plane The plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
290 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
291 liesIn(plane: Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
292
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
293 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
294 * Rotates the vector about the given object. The object should be a point if the vector is 2D,
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
295 * and a line if it is 3D. Be careful with line directions!
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
296 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
297 * @param {number|Matrix} t The angle in radians or in rotation matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
298 * @param {Vector|Line} obj The rotation axis.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
299 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
300 rotate(t: number|Matrix, obj: Vector|Line): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
301
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
302 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
303 * Returns the result of reflecting the point in the given point, line or plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
304 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
305 * @param {Vector|Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
306 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
307 reflectionIn(obj: Vector|Line|Plane): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
308
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
309 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
310 * Utility to make sure vectors are 3D. If they are 2D, a zero z-component is added.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
311 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
312 to3D(): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
313
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
314 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
315 * Returns a string representation of the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
316 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
317 inspect(): string;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
318
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
319 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
320 * Set vector's elements from an array.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
321 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
322 * @param {Vector|Array<number>} els The elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
323 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
324 setElements(els: Vector|Array<number>): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
325 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
326
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
327 interface Matrix {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
328 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
329 * Gets a nested array containing the matrix's elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
330 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
331 elements: Array<Array<number>>;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
332 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
333 * Returns element (i,j) of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
334 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
335 * @param {number} i The row index.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
336 * @param {number} j The column index.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
337 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
338 e(i: number, j: number): any;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
339
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
340 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
341 * Returns row k of the matrix as a vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
342 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
343 * @param {number} i The row index.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
344 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
345 row(i: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
346
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
347 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
348 * Returns column k of the matrix as a vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
349 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
350 * @param {number} j The column index.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
351 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
352 col(j: number): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
353
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
354 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
355 * Returns the number of rows/columns the matrix has.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
356 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
357 * @return {any} An object { rows: , cols: }.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
358 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
359 dimensions(): any;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
360
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
361 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
362 * Returns the number of rows in the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
363 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
364 rows(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
365
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
366 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
367 * Returns the number of columns in the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
368 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
369 cols(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
370
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
371 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
372 * Returns true if the matrix is equal to the argument. You can supply a vector as the argument,
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
373 * in which case the receiver must be a one-column matrix equal to the vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
374 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
375 * @param {Vector|Matrix} matrix The argument to compare.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
376 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
377 eql(matrix: Vector|Matrix): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
378
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
379 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
380 * Returns a copy of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
381 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
382 dup(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
383
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
384 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
385 * Maps the matrix to another matrix (of the same dimensions) according to the given function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
386 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
387 * @param {Function} fn The function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
388 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
389 map(fn: (x: number, i: number, j: number) => any): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
390
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
391 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
392 * Returns true iff the argument has the same dimensions as the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
393 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
394 * @param {Matrix} matrix The other matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
395 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
396 isSameSizeAs(matrix: Matrix): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
397
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
398 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
399 * Returns the result of adding the argument to the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
400 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
401 * @param {Matrix} matrix The matrix to add.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
402 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
403 add(matrix: Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
404
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
405 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
406 * Returns the result of subtracting the argument from the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
407 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
408 * @param {Matrix} matrix The matrix to substract.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
409 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
410 subtract(matrix: Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
411
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
412 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
413 * Returns true iff the matrix can multiply the argument from the left.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
414 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
415 * @param {Matrix} matrix The matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
416 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
417 canMultiplyFromLeft(matrix: Matrix): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
418
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
419 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
420 * Returns the result of multiplying the matrix from the right by the argument. If the argument is a scalar
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
421 * then just multiply all the elements. If the argument is a vector, a vector is returned, which saves you
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
422 * having to remember calling col(1) on the result.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
423 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
424 * @param {number|Matrix} matrix The multiplier.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
425 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
426 multiply(matrix: number|Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
427
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
428 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
429 * Returns the result of multiplying the matrix from the right by the argument. If the argument is a scalar
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
430 * then just multiply all the elements. If the argument is a vector, a vector is returned, which saves you
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
431 * having to remember calling col(1) on the result.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
432 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
433 * @param {Vector} vector The multiplier.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
434 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
435 multiply(vector: Vector): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
436
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
437 x(matrix: number|Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
438
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
439 x(vector: Vector): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
440
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
441 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
442 * Returns a submatrix taken from the matrix. Argument order is: start row, start col, nrows, ncols.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
443 * Element selection wraps if the required index is outside the matrix's bounds, so you could use
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
444 * this to perform row/column cycling or copy-augmenting.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
445 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
446 * @param {number} a Starting row index.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
447 * @param {number} b Starting column index.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
448 * @param {number} c Number of rows.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
449 * @param {number} d Number of columns.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
450 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
451 minor(a: number, b: number, c: number, d: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
452
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
453 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
454 * Returns the transpose of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
455 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
456 transpose(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
457
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
458 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
459 * Returns true if the matrix is square.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
460 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
461 isSquare(): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
462
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
463 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
464 * Returns the (absolute) largest element of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
465 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
466 max(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
467
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
468 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
469 * Returns the indeces of the first match found by reading row-by-row from left to right.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
470 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
471 * @param {number} x The value.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
472 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
473 * @return {any} The element indeces i.e: { row:1, col:1 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
474 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
475 indexOf(x: number): any;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
476
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
477 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
478 * If the matrix is square, returns the diagonal elements as a vector; otherwise, returns null.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
479 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
480 diagonal(): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
481
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
482 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
483 * Make the matrix upper (right) triangular by Gaussian elimination. This method only adds multiples
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
484 * of rows to other rows. No rows are scaled up or switched, and the determinant is preserved.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
485 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
486 toRightTriangular(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
487 toUpperTriangular(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
488
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
489 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
490 * Returns the determinant for square matrices.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
491 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
492 determinant(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
493 det(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
494
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
495 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
496 * Returns true if the matrix is singular.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
497 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
498 isSingular(): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
499
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
500 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
501 * Returns the trace for square matrices.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
502 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
503 trace(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
504 tr(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
505
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
506 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
507 * Returns the rank of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
508 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
509 rank(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
510 rk(): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
511
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
512 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
513 * Returns the result of attaching the given argument to the right-hand side of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
514 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
515 * @param {Matrix|Vector} matrix The matrix or vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
516 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
517 augment(matrix: Matrix|Vector): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
518
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
519 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
520 * Returns the inverse (if one exists) using Gauss-Jordan.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
521 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
522 inverse(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
523 inv(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
524
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
525 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
526 * Returns the result of rounding all the elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
527 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
528 round(): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
529
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
530 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
531 * Returns a copy of the matrix with elements set to the given value if they differ from it
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
532 * by less than Sylvester.precision.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
533 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
534 * @param {number} x The value.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
535 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
536 snapTo(x: number): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
537
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
538 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
539 * Returns a string representation of the matrix.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
540 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
541 inspect(): string;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
542
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
543 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
544 * Set the matrix's elements from an array. If the argument passed is a vector, the resulting matrix
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
545 * will be a single column.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
546 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
547 * @param {Array<number>|Array<Array<number>>|Vector|Matrix} matrix The elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
548 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
549 setElements(matrix: Array<number>|Array<Array<number>>|Vector|Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
550 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
551
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
552 interface Line {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
553 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
554 * Gets the 3D vector corresponding to a point on the line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
555 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
556 anchor: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
557
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
558 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
559 * Gets a normalized 3D vector representing the line's direction.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
560 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
561 direction: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
562
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
563 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
564 * Returns true if the argument occupies the same space as the line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
565 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
566 * @param {Line} line The other line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
567 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
568 eql(line: Line): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
569
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
570 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
571 * Returns a copy of the line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
572 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
573 dup(): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
574
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
575 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
576 * Returns the result of translating the line by the given vector/array.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
577 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
578 * @param {Vector|Array<number>} vector The translation vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
579 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
580 translate(vector: Vector|Array<number>): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
581
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
582 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
583 * Returns true if the line is parallel to the argument. Here, 'parallel to' means that the argument's
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
584 * direction is either parallel or antiparallel to the line's own direction. A line is parallel to a
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
585 * plane if the two do not have a unique intersection.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
586 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
587 * @param {Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
588 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
589 isParallelTo(obj: Line|Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
590
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
591 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
592 * Returns the line's perpendicular distance from the argument, which can be a point, a line or a plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
593 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
594 * @param {Vector|Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
595 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
596 distanceFrom(obj: Vector|Line|Plane): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
597
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
598 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
599 * Returns true if the argument is a point on the line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
600 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
601 * @param {Vector} point The point.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
602 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
603 contains(point: Vector): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
604
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
605 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
606 * Returns true if the line lies in the given plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
607 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
608 * @param {Plane} plane The plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
609 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
610 liesIn(plane: Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
611
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
612 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
613 * Returns true if the line has a unique point of intersection with the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
614 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
615 * @param {Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
616 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
617 intersects(obj: Line|Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
618
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
619 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
620 * Returns the unique intersection point with the argument, if one exists.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
621 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
622 * @param {Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
623 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
624 intersectionWith(obj: Line|Plane): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
625
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
626 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
627 * Returns the point on the line that is closest to the given point or line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
628 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
629 * @param {Vector|Line} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
630 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
631 pointClosestTo(obj: Vector|Line): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
632
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
633 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
634 * Returns a copy of the line rotated by t radians about the given line. Works by finding the argument's
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
635 * closest point to this line's anchor point (call this C) and rotating the anchor about C. Also rotates
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
636 * the line's direction about the argument's. Be careful with this - the rotation axis' direction
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
637 * affects the outcome!
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
638 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
639 * @param {number} t The angle in radians.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
640 * @param {Vector|Line} axis The axis.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
641 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
642 rotate(t: number, axis: Vector|Line): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
643
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
644 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
645 * Returns the line's reflection in the given point or line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
646 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
647 * @param {Vector|Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
648 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
649 reflectionIn(obj: Vector|Line|Plane): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
650
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
651 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
652 * Set the line's anchor point and direction.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
653 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
654 * @param {Array<number>|Vector} anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
655 * @param {Array<number>|Vector} direction The direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
656 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
657 setVectors(anchor: Array<number>|Vector, direction: Array<number>|Vector): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
658 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
659
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
660 interface Plane {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
661 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
662 * Gets the 3D vector corresponding to a point in the plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
663 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
664 anchor: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
665
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
666 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
667 * Gets a normalized 3D vector perpendicular to the plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
668 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
669 normal: Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
670
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
671 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
672 * Returns true if the plane occupies the same space as the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
673 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
674 * @param {Plane} plane The other plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
675 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
676 eql(plane: Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
677
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
678 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
679 * Returns a copy of the plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
680 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
681 dup(): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
682
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
683 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
684 * Returns the result of translating the plane by the given vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
685 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
686 * @param {Array<number>|Vector} vector The translation vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
687 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
688 translate(vector: Array<number>|Vector): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
689
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
690 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
691 * Returns true if the plane is parallel to the argument. Will return true if the planes are equal,
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
692 * or if you give a line and it lies in the plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
693 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
694 * @param {Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
695 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
696 isParallelTo(obj: Line|Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
697
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
698 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
699 * Returns true if the receiver is perpendicular to the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
700 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
701 * @param {Plane} plane The other plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
702 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
703 isPerpendicularTo(plane: Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
704
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
705 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
706 * Returns the plane's distance from the given object (point, line or plane).
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
707 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
708 * @parm {Vector|Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
709 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
710 distanceFrom(obj: Vector|Line|Plane): number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
711
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
712 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
713 * Returns true if the plane contains the given point or line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
714 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
715 * @param {Vector|Line} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
716 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
717 contains(obj: Vector|Line): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
718
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
719 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
720 * Returns true if the plane has a unique point/line of intersection with the argument.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
721 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
722 * @param {Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
723 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
724 intersects(obj: Line|Plane): boolean;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
725
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
726 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
727 * Returns the unique intersection with the argument, if one exists.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
728 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
729 * @param {Line} line The line.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
730 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
731 intersectionWith(line: Line): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
732
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
733 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
734 * Returns the unique intersection with the argument, if one exists.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
735 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
736 * @param {Plane} plane The plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
737 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
738 intersectionWith(plane: Plane): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
739
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
740 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
741 * Returns the point in the plane closest to the given point.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
742 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
743 * @param {Vector} point The point.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
744 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
745 pointClosestTo(point: Vector): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
746
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
747 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
748 * Returns a copy of the plane, rotated by t radians about the given line. See notes on Line#rotate.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
749 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
750 * @param {number} t The angle in radians.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
751 * @param {Line} axis The line axis.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
752 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
753 rotate(t: number, axis: Line): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
754
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
755 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
756 * Returns the reflection of the plane in the given point, line or plane.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
757 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
758 * @param {Vector|Line|Plane} obj The object.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
759 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
760 reflectionIn(obj: Vector|Line|Plane): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
761
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
762 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
763 * Sets the anchor point and normal to the plane. Normal vector is normalised before storage.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
764 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
765 * @param {Array<number>|Vector} anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
766 * @param {Array<number>|Vector} normal The normal vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
767 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
768 setVectors(anchor: Array<number>|Vector, normal: Array<number>|Vector): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
769
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
770 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
771 * Sets the anchor point and normal to the plane. The normal is calculated by assuming the three points
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
772 * should lie in the same plane. Normal vector is normalised before storage.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
773 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
774 * @param {Array<number>|Vector} anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
775 * @param {Array<number>|Vector} v1 The first direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
776 * @param {Array<number>|Vector} v2 The second direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
777 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
778 setVectors(anchor: Array<number>|Vector, v1: Array<number>|Vector, v2: Array<number>|Vector): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
779 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
780
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
781 declare module Sylvester {
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
782 export var version: string;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
783 export var precision: number;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
784 }
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
785
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
786 declare var Vector: Sylvester.VectorStatic;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
787 declare var Matrix: Sylvester.MatrixStatic;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
788 declare var Line: Sylvester.LineStatic;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
789 declare var Plane: Sylvester.PlaneStatic;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
790
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
791 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
792 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
793 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
794 * @param {Vector|Array<number} elements The elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
795 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
796 declare function $V(elements: Vector|Array<number>): Vector;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
797
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
798 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
799 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
800 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
801 * @param {Array<number>|Array<Array<number>>|Vector|Matrix} elements The elements.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
802 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
803 declare function $M(elements: Array<number>|Array<Array<number>>|Vector | Matrix): Matrix;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
804
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
805 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
806 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
807 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
808 * @param Array<number>|Vector anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
809 * @param Array<number>|Vector direction The direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
810 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
811 declare function $L(anchor: Array<number>|Vector, direction: Array<number>|Vector): Line;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
812
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
813 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
814 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
815 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
816 * @param {Array<number>|Vector} anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
817 * @param {Array<number>|Vector} normal The normal vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
818 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
819 declare function $P(anchor: Array<number>|Vector, normal: Array<number>|Vector): Plane;
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
820
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
821 /**
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
822 * Constructor function.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
823 *
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
824 * @param {Array<number>|Vector} anchor The anchor vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
825 * @param {Array<number>|Vector} v1 The first direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
826 * @param {Array<number>|Vecotr} v2 The second direction vector.
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
827 */
0bc66003fa47 copy from DefinitelyTyped
drewp@bigasterisk.com
parents:
diff changeset
828 declare function $P(anchor: Array<number>|Vector, v1: Array<number>|Vector, v2: Array<number>|Vector): Plane;