Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vector3

Serializable THREE.js Vector3

Hierarchy

Index

Constructors

constructor

  • new Vector3(x?: number, y?: number, z?: number): Vector3
  • Parameters

    • Optional x: number
    • Optional y: number
    • Optional z: number

    Returns Vector3

Properties

Readonly isVector3

isVector3: true

x

x: number

y

y: number

z

z: number

Methods

add

  • Adds v to this vector.

    Parameters

    • v: Vector3

    Returns Vector3

addScalar

  • Parameters

    • s: number

    Returns Vector3

addScaledVector

  • addScaledVector(v: Vector3, s: number): Vector3
  • Parameters

    • v: Vector3
    • s: number

    Returns Vector3

addVectors

  • addVectors(a: Vector3, b: Vector3): Vector3
  • Sets this vector to a + b.

    Parameters

    • a: Vector3
    • b: Vector3

    Returns Vector3

angleTo

  • angleTo(v: Vector3): number
  • Parameters

    • v: Vector3

    Returns number

applyAxisAngle

  • applyAxisAngle(axis: Vector3, angle: number): Vector3
  • Parameters

    • axis: Vector3
    • angle: number

    Returns Vector3

applyEuler

  • applyEuler(euler: Euler): Vector3
  • Parameters

    • euler: Euler

    Returns Vector3

applyMatrix3

  • applyMatrix3(m: Matrix3): Vector3
  • Parameters

    • m: Matrix3

    Returns Vector3

applyMatrix4

  • applyMatrix4(m: Matrix4): Vector3
  • Parameters

    • m: Matrix4

    Returns Vector3

applyNormalMatrix

  • applyNormalMatrix(m: Matrix3): Vector3
  • Parameters

    • m: Matrix3

    Returns Vector3

applyQuaternion

  • applyQuaternion(q: Quaternion): Vector3
  • Parameters

    • q: Quaternion

    Returns Vector3

ceil

  • Returns Vector3

clamp

  • clamp(min: Vector3, max: Vector3): Vector3
  • Parameters

    • min: Vector3
    • max: Vector3

    Returns Vector3

clampLength

  • clampLength(min: number, max: number): Vector3
  • Parameters

    • min: number
    • max: number

    Returns Vector3

clampScalar

  • clampScalar(min: number, max: number): Vector3
  • Parameters

    • min: number
    • max: number

    Returns Vector3

clone

copy

  • Copies value of v to this vector.

    Parameters

    • v: Vector3

    Returns Vector3

cross

  • Sets this vector to cross product of itself and v.

    Parameters

    • a: Vector3

    Returns Vector3

crossVectors

  • crossVectors(a: Vector3, b: Vector3): Vector3
  • Sets this vector to cross product of a and b.

    Parameters

    • a: Vector3
    • b: Vector3

    Returns Vector3

distanceTo

  • distanceTo(v: Vector3): number
  • Computes distance of this vector to v.

    Parameters

    • v: Vector3

    Returns number

distanceToManhattan

  • distanceToManhattan(v: Vector3): number
  • deprecated

    Use {@link Vector3#manhattanDistanceTo .manhattanDistanceTo()} instead.

    Parameters

    • v: Vector3

    Returns number

distanceToSquared

  • distanceToSquared(v: Vector3): number
  • Computes squared distance of this vector to v.

    Parameters

    • v: Vector3

    Returns number

divide

  • Parameters

    • v: Vector3

    Returns Vector3

divideScalar

  • Divides this vector by scalar s. Set vector to ( 0, 0, 0 ) if s == 0.

    Parameters

    • s: number

    Returns Vector3

dot

  • dot(v: Vector3): number
  • Computes dot product of this vector and v.

    Parameters

    • v: Vector3

    Returns number

equals

  • equals(v: Vector3): boolean
  • Checks for strict equality of this vector and v.

    Parameters

    • v: Vector3

    Returns boolean

floor

  • Returns Vector3

fromArray

  • fromArray(array: number[] | ArrayLike<number>, offset?: number): Vector3
  • Sets this vector's x, y and z value from the provided array or array-like.

    Parameters

    • array: number[] | ArrayLike<number>

      the source array or array-like.

    • Optional offset: number

      (optional) offset into the array. Default is 0.

    Returns Vector3

fromBufferAttribute

  • fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): Vector3
  • Parameters

    • attribute: BufferAttribute | InterleavedBufferAttribute
    • index: number

    Returns Vector3

getComponent

  • getComponent(index: number): number
  • Parameters

    • index: number

    Returns number

length

  • length(): number
  • Computes length of this vector.

    Returns number

lengthManhattan

  • lengthManhattan(): number
  • Computes Manhattan length of this vector. http://en.wikipedia.org/wiki/Taxicab_geometry

    deprecated

    Use {@link Vector3#manhattanLength .manhattanLength()} instead.

    Returns number

lengthSq

  • lengthSq(): number
  • Computes squared length of this vector.

    Returns number

lerp

  • lerp(v: Vector3, alpha: number): Vector3
  • Parameters

    • v: Vector3
    • alpha: number

    Returns Vector3

lerpVectors

  • lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3
  • Parameters

    • v1: Vector3
    • v2: Vector3
    • alpha: number

    Returns Vector3

manhattanDistanceTo

  • manhattanDistanceTo(v: Vector3): number
  • Computes the Manhattan length (distance) from this vector to the given vector v

    see Wikipedia: Taxicab Geometry

    Parameters

    • v: Vector3

    Returns number

manhattanLength

  • manhattanLength(): number
  • Computes the Manhattan length of this vector.

    see Wikipedia: Taxicab Geometry

    Returns number

max

  • Parameters

    • v: Vector3

    Returns Vector3

min

  • Parameters

    • v: Vector3

    Returns Vector3

multiply

  • Parameters

    • v: Vector3

    Returns Vector3

multiplyScalar

  • multiplyScalar(s: number): Vector3
  • Multiplies this vector by scalar s.

    Parameters

    • s: number

    Returns Vector3

multiplyVectors

  • multiplyVectors(a: Vector3, b: Vector3): Vector3
  • Parameters

    • a: Vector3
    • b: Vector3

    Returns Vector3

negate

  • Inverts this vector.

    Returns Vector3

normalize

  • Normalizes this vector.

    Returns Vector3

project

  • Parameters

    • camera: Camera

    Returns Vector3

projectOnPlane

  • projectOnPlane(planeNormal: Vector3): Vector3
  • Parameters

    • planeNormal: Vector3

    Returns Vector3

projectOnVector

  • projectOnVector(v: Vector3): Vector3
  • Parameters

    • v: Vector3

    Returns Vector3

random

  • Sets this vector's x, y and z from Math.random

    Returns Vector3

reflect

  • reflect(vector: Vector3): Vector3
  • Parameters

    • vector: Vector3

    Returns Vector3

round

  • Returns Vector3

roundToZero

  • Returns Vector3

set

  • set(x: number, y: number, z: number): Vector3
  • Sets value of this vector.

    Parameters

    • x: number
    • y: number
    • z: number

    Returns Vector3

setComponent

  • setComponent(index: number, value: number): Vector3
  • Parameters

    • index: number
    • value: number

    Returns Vector3

setFromCylindrical

  • setFromCylindrical(s: Cylindrical): Vector3
  • Parameters

    • s: Cylindrical

    Returns Vector3

setFromCylindricalCoords

  • setFromCylindricalCoords(radius: number, theta: number, y: number): Vector3
  • Parameters

    • radius: number
    • theta: number
    • y: number

    Returns Vector3

setFromMatrix3Column

  • setFromMatrix3Column(matrix: Matrix3, index: number): Vector3
  • Parameters

    • matrix: Matrix3
    • index: number

    Returns Vector3

setFromMatrixColumn

  • setFromMatrixColumn(matrix: Matrix4, index: number): Vector3
  • Parameters

    • matrix: Matrix4
    • index: number

    Returns Vector3

setFromMatrixPosition

  • setFromMatrixPosition(m: Matrix4): Vector3
  • Parameters

    • m: Matrix4

    Returns Vector3

setFromMatrixScale

  • setFromMatrixScale(m: Matrix4): Vector3
  • Parameters

    • m: Matrix4

    Returns Vector3

setFromSpherical

  • setFromSpherical(s: Spherical): Vector3
  • Parameters

    • s: Spherical

    Returns Vector3

setFromSphericalCoords

  • setFromSphericalCoords(r: number, phi: number, theta: number): Vector3
  • Parameters

    • r: number
    • phi: number
    • theta: number

    Returns Vector3

setLength

  • Normalizes this vector and multiplies it by l.

    Parameters

    • l: number

    Returns Vector3

setScalar

  • setScalar(scalar: number): Vector3
  • Sets all values of this vector.

    Parameters

    • scalar: number

    Returns Vector3

setX

  • setX(x: number): Vector3
  • Sets x value of this vector.

    Parameters

    • x: number

    Returns Vector3

setY

  • setY(y: number): Vector3
  • Sets y value of this vector.

    Parameters

    • y: number

    Returns Vector3

setZ

  • setZ(z: number): Vector3
  • Sets z value of this vector.

    Parameters

    • z: number

    Returns Vector3

sub

  • Subtracts v from this vector.

    Parameters

    • a: Vector3

    Returns Vector3

subScalar

  • Parameters

    • s: number

    Returns Vector3

subVectors

  • subVectors(a: Vector3, b: Vector3): Vector3
  • Sets this vector to a - b.

    Parameters

    • a: Vector3
    • b: Vector3

    Returns Vector3

toArray

  • toArray(array?: number[], offset?: number): number[]
  • toArray(array?: Vector3Tuple, offset?: 0): Vector3Tuple
  • toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>
  • Returns an array [x, y, z], or copies x, y and z into the provided array.

    Parameters

    • Optional array: number[]

      (optional) array to store the vector to. If this is not provided, a new array will be created.

    • Optional offset: number

      (optional) optional offset into the array.

    Returns number[]

    The created or provided array.

  • Parameters

    • Optional array: Vector3Tuple
    • Optional offset: 0

    Returns Vector3Tuple

  • Copies x, y and z into the provided array-like.

    Parameters

    • array: ArrayLike<number>

      array-like to store the vector to.

    • Optional offset: number

      (optional) optional offset into the array-like.

    Returns ArrayLike<number>

    The provided array-like.

transformDirection

  • transformDirection(m: Matrix4): Vector3
  • Parameters

    • m: Matrix4

    Returns Vector3

unproject

  • unproject(camera: Camera): Vector3
  • Parameters

    • camera: Camera

    Returns Vector3

Static fromArray

  • fromArray(array: number[]): Vector3