Spaces:
Running
Running
File size: 5,993 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 272 |
import { Euler } from './Euler';
import { Matrix3 } from './Matrix3';
import { Matrix4 } from './Matrix4';
import { Quaternion } from './Quaternion';
import { Camera } from './../cameras/Camera';
import { Spherical } from './Spherical';
import { Cylindrical } from './Cylindrical';
import { BufferAttribute } from './../core/BufferAttribute';
import { Vector } from './Vector2';
/**
* 3D vector.
*
* @example
* var a = new THREE.Vector3( 1, 0, 0 );
* var b = new THREE.Vector3( 0, 1, 0 );
* var c = new THREE.Vector3();
* c.crossVectors( a, b );
*
* @see <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Vector3.js">src/math/Vector3.js</a>
*
* ( class Vector3 implements Vector<Vector3> )
*/
export class Vector3 implements Vector {
constructor(x?: number, y?: number, z?: number);
x: number;
y: number;
z: number;
isVector3: true;
/**
* Sets value of this vector.
*/
set(x: number, y: number, z: number): this;
/**
* Sets all values of this vector.
*/
setScalar(scalar: number): this;
/**
* Sets x value of this vector.
*/
setX(x: number): Vector3;
/**
* Sets y value of this vector.
*/
setY(y: number): Vector3;
/**
* Sets z value of this vector.
*/
setZ(z: number): Vector3;
setComponent(index: number, value: number): this;
getComponent(index: number): number;
/**
* Clones this vector.
*/
clone(): this;
/**
* Copies value of v to this vector.
*/
copy(v: Vector3): this;
/**
* Adds v to this vector.
*/
add(a: Vector3, b?: Vector3): this;
addScalar(s: number): this;
addScaledVector(v: Vector3, s: number): this;
/**
* Sets this vector to a + b.
*/
addVectors(a: Vector3, b: Vector3): this;
/**
* Subtracts v from this vector.
*/
sub(a: Vector3): this;
subScalar(s: number): this;
/**
* Sets this vector to a - b.
*/
subVectors(a: Vector3, b: Vector3): this;
multiply(v: Vector3): this;
/**
* Multiplies this vector by scalar s.
*/
multiplyScalar(s: number): this;
multiplyVectors(a: Vector3, b: Vector3): this;
applyEuler(euler: Euler): this;
applyAxisAngle(axis: Vector3, angle: number): this;
applyMatrix3(m: Matrix3): this;
applyMatrix4(m: Matrix4): this;
applyQuaternion(q: Quaternion): this;
project(camera: Camera): this;
unproject(camera: Camera): this;
transformDirection(m: Matrix4): this;
divide(v: Vector3): this;
/**
* Divides this vector by scalar s.
* Set vector to ( 0, 0, 0 ) if s == 0.
*/
divideScalar(s: number): this;
min(v: Vector3): this;
max(v: Vector3): this;
clamp(min: Vector3, max: Vector3): this;
clampScalar(min: number, max: number): this;
clampLength(min: number, max: number): this;
floor(): this;
ceil(): this;
round(): this;
roundToZero(): this;
/**
* Inverts this vector.
*/
negate(): this;
/**
* Computes dot product of this vector and v.
*/
dot(v: Vector3): number;
/**
* Computes squared length of this vector.
*/
lengthSq(): number;
/**
* Computes length of this vector.
*/
length(): number;
/**
* Computes Manhattan length of this vector.
* http://en.wikipedia.org/wiki/Taxicab_geometry
*
* @deprecated Use {@link Vector3#manhattanLength .manhattanLength()} instead.
*/
lengthManhattan(): number;
/**
* Computes the Manhattan length of this vector.
*
* @return {number}
*
* @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry}
*/
manhattanLength(): number;
/**
* Computes the Manhattan length (distance) from this vector to the given vector v
*
* @param {Vector3} v
*
* @return {number}
*
* @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry}
*/
manhattanDistanceTo(v: Vector3): number;
/**
* Normalizes this vector.
*/
normalize(): this;
/**
* Normalizes this vector and multiplies it by l.
*/
setLength(l: number): this;
lerp(v: Vector3, alpha: number): this;
lerpVectors(v1: Vector3, v2: Vector3, alpha: number): this;
/**
* Sets this vector to cross product of itself and v.
*/
cross(a: Vector3, w?: Vector3): this;
/**
* Sets this vector to cross product of a and b.
*/
crossVectors(a: Vector3, b: Vector3): this;
projectOnVector(v: Vector3): this;
projectOnPlane(planeNormal: Vector3): this;
reflect(vector: Vector3): this;
angleTo(v: Vector3): number;
/**
* Computes distance of this vector to v.
*/
distanceTo(v: Vector3): number;
/**
* Computes squared distance of this vector to v.
*/
distanceToSquared(v: Vector3): number;
/**
* @deprecated Use {@link Vector3#manhattanDistanceTo .manhattanDistanceTo()} instead.
*/
distanceToManhattan(v: Vector3): number;
setFromSpherical(s: Spherical): this;
setFromCylindrical(s: Cylindrical): this;
setFromMatrixPosition(m: Matrix4): this;
setFromMatrixScale(m: Matrix4): this;
setFromMatrixColumn(matrix: Matrix4, index: number): this;
/**
* Checks for strict equality of this vector and v.
*/
equals(v: Vector3): boolean;
fromArray(xyz: number[], offset?: number): Vector3;
/**
* Returns an array [x, y, z], or copies x, y and z into the provided array.
* @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
*/
toArray(xyz?: number[], offset?: number): number[];
/**
* Copies x, y and z into the provided array-like.
* @param array array-like to store the vector to.
* @param offset (optional) optional offset into the array.
* @return The provided array-like.
*/
toArray(xyz: ArrayLike<number>, offset?: number): ArrayLike<number>;
fromBufferAttribute(
attribute: BufferAttribute,
index: number,
offset?: number
): this;
}
|