Class Vector3

Example

const a = new THREE.Vector3( 1, 0, 0 );
const b = new THREE.Vector3( 0, 1, 0 );
const c = new THREE.Vector3();
c.crossVectors( a, b );

Constructors

  • Parameters

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

    Returns Vector3

Properties

isVector3: true
x: number

Default

0
y: number

Default

0
z: number

Default

0

Methods

  • Iterating through a Vector3 instance will yield its components (x, y, z) in the corresponding order.

    Returns Iterator<number, any, undefined>

  • Adds v to this vector.

    Parameters

    • v: Vector3Like

    Returns this

  • Parameters

    • s: number

    Returns this

  • Parameters

    Returns this

  • Sets this vector to a + b.

    Parameters

    • a: Vector3Like
    • b: Vector3Like

    Returns this

  • Parameters

    Returns number

  • Parameters

    Returns this

  • Parameters

    • euler: Euler

    Returns this

  • Parameters

    • m: Matrix3

    Returns this

  • Parameters

    • m: Matrix4

    Returns this

  • Parameters

    • m: Matrix3

    Returns this

  • Parameters

    • q: QuaternionLike

    Returns this

  • Returns this

  • Parameters

    • min: Vector3Like
    • max: Vector3Like

    Returns this

  • Parameters

    • min: number
    • max: number

    Returns this

  • Parameters

    • min: number
    • max: number

    Returns this

  • Clones this vector.

    Returns this

  • Copies value of v to this vector.

    Parameters

    • v: Vector3Like

    Returns this

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

    Parameters

    • a: Vector3Like

    Returns this

  • Sets this vector to cross product of a and b.

    Parameters

    • a: Vector3Like
    • b: Vector3Like

    Returns this

  • Computes distance of this vector to v.

    Parameters

    • v: Vector3Like

    Returns number

  • Computes squared distance of this vector to v.

    Parameters

    • v: Vector3Like

    Returns number

  • Parameters

    • v: Vector3Like

    Returns this

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

    Parameters

    • s: number

    Returns this

  • Computes dot product of this vector and v.

    Parameters

    • v: Vector3Like

    Returns number

  • Checks for strict equality of this vector and v.

    Parameters

    • v: Vector3Like

    Returns boolean

  • Returns this

  • 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 this

  • Parameters

    • attribute: BufferAttribute | InterleavedBufferAttribute
    • index: number

    Returns this

  • Parameters

    • index: number

    Returns number

  • Computes length of this vector.

    Returns number

  • Computes squared length of this vector.

    Returns number

  • Parameters

    • v: Vector3Like
    • alpha: number

    Returns this

  • Parameters

    • v1: Vector3Like
    • v2: Vector3Like
    • alpha: number

    Returns this

  • Computes the Manhattan length (distance) from this vector to the given vector v

    see Taxicab Geometry

    Parameters

    • v: Vector3Like

    Returns number

  • Computes the Manhattan length of this vector.

    see Taxicab Geometry

    Returns number

  • Parameters

    • v: Vector3Like

    Returns this

  • Parameters

    • v: Vector3Like

    Returns this

  • Parameters

    • v: Vector3Like

    Returns this

  • Multiplies this vector by scalar s.

    Parameters

    • s: number

    Returns this

  • Parameters

    • a: Vector3Like
    • b: Vector3Like

    Returns this

  • Inverts this vector.

    Returns this

  • Normalizes this vector.

    Returns this

  • Parameters

    • camera: Camera

    Returns this

  • Parameters

    Returns this

  • Parameters

    Returns this

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

    Returns this

  • Returns this

  • Parameters

    • vector: Vector3Like

    Returns this

  • Returns this

  • Returns this

  • Sets value of this vector.

    Parameters

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

    Returns this

  • Parameters

    • index: number
    • value: number

    Returns this

  • Sets this vector's x, y and z components from the r, g, and b components of the specified Color | color.

    Parameters

    • color: RGB

    Returns this

  • Parameters

    • s: Cylindrical

    Returns this

  • Parameters

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

    Returns this

  • Sets this vector's x, y and z components from the x, y, and z components of the specified Euler Euler Angle.

    Parameters

    • e: Euler

    Returns this

  • Parameters

    • matrix: Matrix3
    • index: number

    Returns this

  • Parameters

    • matrix: Matrix4
    • index: number

    Returns this

  • Parameters

    • m: Matrix4

    Returns this

  • Parameters

    • m: Matrix4

    Returns this

  • Parameters

    • s: Spherical

    Returns this

  • Parameters

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

    Returns this

  • Normalizes this vector and multiplies it by l.

    Parameters

    • l: number

    Returns this

  • Sets all values of this vector.

    Parameters

    • scalar: number

    Returns this

  • Sets x value of this vector.

    Parameters

    • x: number

    Returns this

  • Sets y value of this vector.

    Parameters

    • y: number

    Returns this

  • Sets z value of this vector.

    Parameters

    • z: number

    Returns this

  • Subtracts v from this vector.

    Parameters

    • a: Vector3Like

    Returns this

  • Parameters

    • s: number

    Returns this

  • Sets this vector to a - b.

    Parameters

    • a: Vector3Like
    • b: Vector3Like

    Returns this

  • 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.

  • Parameters

    • m: Matrix4

    Returns this

  • Parameters

    • camera: Camera

    Returns this

Generated using TypeDoc