Spaces:
Running
Running
File size: 6,734 Bytes
6cd9596 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
import { Vector3 } from './Vector3';
import { Euler } from './Euler';
import { Quaternion } from './Quaternion';
import { BufferAttribute } from './../core/BufferAttribute';
import { Matrix } from './Matrix3';
/**
* A 4x4 Matrix.
*
* @example
* // Simple rig for rotating around 3 axes
* var m = new THREE.Matrix4();
* var m1 = new THREE.Matrix4();
* var m2 = new THREE.Matrix4();
* var m3 = new THREE.Matrix4();
* var alpha = 0;
* var beta = Math.PI;
* var gamma = Math.PI/2;
* m1.makeRotationX( alpha );
* m2.makeRotationY( beta );
* m3.makeRotationZ( gamma );
* m.multiplyMatrices( m1, m2 );
* m.multiply( m3 );
*/
export class Matrix4 implements Matrix {
constructor();
/**
* Array with matrix values.
*/
elements: number[];
/**
* Sets all fields of this matrix.
*/
set(
n11: number,
n12: number,
n13: number,
n14: number,
n21: number,
n22: number,
n23: number,
n24: number,
n31: number,
n32: number,
n33: number,
n34: number,
n41: number,
n42: number,
n43: number,
n44: number
): Matrix4;
/**
* Resets this matrix to identity.
*/
identity(): Matrix4;
clone(): this;
copy(m: Matrix4): this;
copyPosition(m: Matrix4): Matrix4;
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4;
makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4;
/**
* Copies the rotation component of the supplied matrix m into this matrix rotation component.
*/
extractRotation(m: Matrix4): Matrix4;
makeRotationFromEuler(euler: Euler): Matrix4;
makeRotationFromQuaternion(q: Quaternion): Matrix4;
/**
* Constructs a rotation matrix, looking from eye towards center with defined up vector.
*/
lookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix4;
/**
* Multiplies this matrix by m.
*/
multiply(m: Matrix4): Matrix4;
premultiply(m: Matrix4): Matrix4;
/**
* Sets this matrix to a x b.
*/
multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4;
/**
* Sets this matrix to a x b and stores the result into the flat array r.
* r can be either a regular Array or a TypedArray.
*
* @deprecated This method has been removed completely.
*/
multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4;
/**
* Multiplies this matrix by s.
*/
multiplyScalar(s: number): Matrix4;
/**
* @deprecated Use {@link Matrix4#applyToBufferAttribute matrix4.applyToBufferAttribute( attribute )} instead.
*/
applyToBuffer(
buffer: BufferAttribute,
offset?: number,
length?: number
): BufferAttribute;
applyToBufferAttribute(attribute: BufferAttribute): BufferAttribute;
/**
* Computes determinant of this matrix.
* Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
*/
determinant(): number;
/**
* Transposes this matrix.
*/
transpose(): Matrix4;
/**
* Sets the position component for this matrix from vector v.
*/
setPosition(v: Vector3): Matrix4;
/**
* Sets this matrix to the inverse of matrix m.
* Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm.
*/
getInverse(m: Matrix4, throwOnDegeneratee?: boolean): Matrix4;
/**
* Multiplies the columns of this matrix by vector v.
*/
scale(v: Vector3): Matrix4;
getMaxScaleOnAxis(): number;
/**
* Sets this matrix as translation transform.
*/
makeTranslation(x: number, y: number, z: number): Matrix4;
/**
* Sets this matrix as rotation transform around x axis by theta radians.
*
* @param theta Rotation angle in radians.
*/
makeRotationX(theta: number): Matrix4;
/**
* Sets this matrix as rotation transform around y axis by theta radians.
*
* @param theta Rotation angle in radians.
*/
makeRotationY(theta: number): Matrix4;
/**
* Sets this matrix as rotation transform around z axis by theta radians.
*
* @param theta Rotation angle in radians.
*/
makeRotationZ(theta: number): Matrix4;
/**
* Sets this matrix as rotation transform around axis by angle radians.
* Based on http://www.gamedev.net/reference/articles/article1199.asp.
*
* @param axis Rotation axis.
* @param theta Rotation angle in radians.
*/
makeRotationAxis(axis: Vector3, angle: number): Matrix4;
/**
* Sets this matrix as scale transform.
*/
makeScale(x: number, y: number, z: number): Matrix4;
/**
* Sets this matrix to the transformation composed of translation, rotation and scale.
*/
compose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4;
/**
* Decomposes this matrix into the translation, rotation and scale components.
* If parameters are not passed, new instances will be created.
*/
decompose(
translation?: Vector3,
rotation?: Quaternion,
scale?: Vector3
): Object[]; // [Vector3, Quaternion, Vector3]
/**
* Creates a frustum matrix.
*/
makePerspective(
left: number,
right: number,
bottom: number,
top: number,
near: number,
far: number
): Matrix4;
/**
* Creates a perspective projection matrix.
*/
makePerspective(
fov: number,
aspect: number,
near: number,
far: number
): Matrix4;
/**
* Creates an orthographic projection matrix.
*/
makeOrthographic(
left: number,
right: number,
top: number,
bottom: number,
near: number,
far: number
): Matrix4;
equals(matrix: Matrix4): boolean;
fromArray(array: number[], offset?: number): Matrix4;
toArray(): number[];
/**
* @deprecated Use {@link Matrix4#copyPosition .copyPosition()} instead.
*/
extractPosition(m: Matrix4): Matrix4;
/**
* @deprecated Use {@link Matrix4#makeRotationFromQuaternion .makeRotationFromQuaternion()} instead.
*/
setRotationFromQuaternion(q: Quaternion): Matrix4;
/**
* @deprecated Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead.
*/
multiplyVector3(v: any): any;
/**
* @deprecated Use {@link Vector4#applyMatrix4 vector.applyMatrix4( matrix )} instead.
*/
multiplyVector4(v: any): any;
/**
* @deprecated This method has been removed completely.
*/
multiplyVector3Array(array: number[]): number[];
/**
* @deprecated Use {@link Vector3#transformDirection Vector3.transformDirection( matrix )} instead.
*/
rotateAxis(v: any): void;
/**
* @deprecated Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead.
*/
crossVector(v: any): void;
/**
* @deprecated Use {@link Matrix4#toArray .toArray()} instead.
*/
flattenToArrayOffset(array: number[], offset: number): number[];
}
|