Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Vector3

Index

Constructors

constructor

Properties

x

x: number

The x component of the vector.

y

y: number

The y component of the vector.

z

z: number

The z component of the vector.

Methods

absolute

add

  • Add the supplied vector to this one.

    Parameters

    Returns Vector3

    this

  • Increment the components of this vector by the given values.

    Parameters

    • x: number

      the x component to add

    • y: number

      the y component to add

    • z: number

      the z component to add

    • Optional dest: Vector3

    Returns Vector3

    this

angle

angleCos

angleSigned

  • angleSigned(v: Vector3, n: Vector3): number
  • angleSigned(x: number, y: number, z: number, nx: number, ny: number, nz: number): number

ceil

  • Set each component of this vector to the smallest (closest to negative infinity) {@code float} value that is greater than or equal to that component and is equal to a mathematical integer.

    Parameters

    Returns Vector3

    this

clone

cross

  • Set this vector to be the cross product of itself and v.

    Parameters

    Returns Vector3

    this

  • Set this vector to be the cross product of itself and (x, y, z).

    Parameters

    • x: number

      the x component of the other vector

    • y: number

      the y component of the other vector

    • z: number

      the z component of the other vector

    • dest: Vector3

    Returns Vector3

    this

distance

  • distance(v: Vector3): number
  • distance(x: number, y: number, z: number): number

distanceSquared

  • distanceSquared(v: Vector3): number
  • distanceSquared(x: number, y: number, z: number): number

div

  • Divide this Vector3f component-wise by another Vector3fc.

    Parameters

    Returns Vector3

    this

  • Divide all components of this Vector3 by the given scalar value.

    Parameters

    • scalar: number

      the scalar to divide by

    • Optional dest: Vector3

    Returns Vector3

    this

  • Divide the components of this Vector3f by the given scalar values and store the result in this.

    Parameters

    • x: number

      the x component to divide this vector by

    • y: number

      the y component to divide this vector by

    • z: number

      the z component to divide this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

dot

  • dot(v: Vector3): number
  • dot(x: number, y: number, z: number): number
  • Get the dot product of this vector and v.

    Parameters

    • v: Vector3

      the vector to dot multiply

    Returns number

    the dot product

  • Get the dot product of this vector and (x, y, z).

    Parameters

    • x: number

      the x component to dot multiply

    • y: number

      the y component to dot multiply

    • z: number

      the z component to dot multiply

    Returns number

    the dot product

equals

  • equals(v: Vector3, delta?: number): boolean
  • equals(x: number, y: number, z: number): boolean

floor

  • Set each component of this vector to the largest (closest to positive infinity) {@code float} value that is less than or equal to that component and is equal to a mathematical integer.

    Parameters

    Returns Vector3

    this

fma

  • Add the component-wise multiplication of a * b to this vector.

    Parameters

    Returns Vector3

    this

  • Add the component-wise multiplication of a * b to this vector.

    Parameters

    • a: number

      the first multiplicand

    • b: Vector3

      the second multiplicand

    • Optional dest: Vector3

    Returns Vector3

    this

get

half

  • Compute the half vector between this and the other vector.

    Parameters

    Returns Vector3

    this

  • Compute the half vector between this and the vector (x, y, z).

    Parameters

    • x: number

      the x component of the other vector

    • y: number

      the y component of the other vector

    • z: number

      the z component of the other vector

    • Optional dest: Vector3

    Returns Vector3

    this

hermite

isFinite

  • isFinite(): boolean

length

  • length(): number

lengthSquared

  • lengthSquared(): number

lerp

  • Linearly interpolate this and other using the given interpolation factor t and store the result in this.

    If `t` is `0.0` then the result is `this`. If the interpolation factor is `1.0` then the result is `other`.

    Parameters

    • other: Vector3

      the other vector

    • t: number

      the interpolation factor between 0.0 and 1.0

    • Optional dest: Vector3

    Returns Vector3

    this

max

  • Set the components of this vector to be the component-wise maximum of this and the other vector.

    Parameters

    Returns Vector3

    this

maxComponent

  • maxComponent(): 0 | 1 | 2

min

  • Set the components of this vector to be the component-wise minimum of this and the other vector.

    Parameters

    Returns Vector3

    this

minComponent

  • minComponent(): 0 | 1 | 2

mul

  • Multiply all components of this Vector3 by the given scalar value.

    Parameters

    • scalar: number

      the scalar to multiply this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

  • Multiply the components of this Vector3f by the given scalar values and store the result in dest or this.

    Parameters

    • x: number

      the x component to multiply this vector by

    • y: number

      the y component to multiply this vector by

    • z: number

      the z component to multiply this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

  • Multiply this Vector3f component-wise by another Vector3fc.

    Parameters

    Returns Vector3

    this

  • Multiply the given matrix with this Vector3f and store the result in dest or this.

    Parameters

    Returns Vector3

    this

mulAdd

  • Add the component-wise multiplication of this * a to b and store the result in this.

    Parameters

    Returns Vector3

    this

  • Add the component-wise multiplication of this * a to b and store the result in this.

    Parameters

    • a: number

      the multiplicand

    • b: Vector3

      the addend

    • Optional dest: Vector3

    Returns Vector3

    this

mulDirection

  • Multiply the given 4x4 matrix mat with this.

    • This method assumes the w component of this to be 0.0.

    Parameters

    • mat: Matrix4

      the matrix to multiply this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

mulPosition

  • Multiply the given 4x4 matrix mat with this.

    This method assumes the `w` component of `this` to be `1.0`.

    Parameters

    • mat: Matrix4

      the matrix to multiply this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

mulPositionW

  • Multiply the given 4x4 matrix mat with this and return the w component of the resulting 4D vector.

    • This method assumes the w component of this to be 1.0.

    Parameters

    • Optional mat: Matrix4

      the matrix to multiply this vector by

    • Optional dest: Vector3

    Returns number

    the w component of the resulting 4D vector after multiplication

mulProject

mulTranspose

mulTransposeDirection

  • Multiply the transpose of the given 4x4 matrix mat with this.

    • This method assumes the w component of this to be 0.0.

    Parameters

    • mat: Matrix4

      the matrix whose transpose to multiply this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

mulTransposePosition

  • Multiply the transpose of the given 4x4 matrix mat with this.

    • This method assumes the w component of this to be 1.0.

    Parameters

    • mat: Matrix4

      the matrix whose transpose to multiply this vector by

    • Optional dest: Vector3

    Returns Vector3

    this

negate

normalize

orthogonalize

orthogonalizeUnit

reflect

  • Reflect this vector about the given normal vector.

    Parameters

    Returns Vector3

    this

  • Reflect this vector about the given normal vector.

    Parameters

    • x: number

      the x component of the normal

    • y: number

      the y component of the normal

    • z: number

      the z component of the normal

    • Optional dest: Vector3

    Returns Vector3

    this

rotate

  • Rotate this vector by the given quaternion quat and store the result in this.

    see

    Quaternionfc#transform(Vector3f)

    Parameters

    Returns Vector3

    this

rotateAxis

  • rotateAxis(angle: number, aX: number, aY: number, aZ: number, dest?: Vector3): Vector3
  • Rotate this vector the specified radians around the given rotation axis.

    Parameters

    • angle: number

      the angle in radians

    • aX: number
    • aY: number
    • aZ: number
    • Optional dest: Vector3

    Returns Vector3

    this

rotateX

  • Rotate this vector the specified radians around the X axis.

    Parameters

    • angle: number

      the angle in radians

    • Optional dest: Vector3

    Returns Vector3

    this

rotateY

  • Rotate this vector the specified radians around the Y axis.

    Parameters

    • angle: number

      the angle in radians

    • Optional dest: Vector3

    Returns Vector3

    this

rotateZ

  • Rotate this vector the specified radians around the Z axis.

    Parameters

    • angle: number

      the angle in radians

    • Optional dest: Vector3

    Returns Vector3

    this

rotationTo

round

  • Set each component of this vector to the closest float that is equal to a mathematical integer, with ties rounding to positive infinity.

    Parameters

    Returns Vector3

    this

set

  • Set the x, y and z components to match the supplied vector.

    Parameters

    • v: Vector3

      contains the values of x, y and z to set

    Returns Vector3

    this

  • Set the first two components from the given v and the z component from the given z

    Parameters

    • v: Vector2

      the Vector2 to copy the values from

    • z: number

      the z component

    Returns Vector3

    this

  • Set the x, y, and z components to the supplied value.

    Parameters

    • d: number

      the value of all three components

    Returns Vector3

    this

  • Set the x, y and z components to the supplied values.

    Parameters

    • x: number

      the x component

    • y: number

      the y component

    • z: number

      the z component

    Returns Vector3

    this

setComponent

  • setComponent(component: number, value: number): Vector3
  • Set the value of the specified component of this vector.

    throws

    IllegalArgumentException if component is not within [0..2]

    Parameters

    • component: number

      the component whose value to set, within [0..2]

    • value: number

      the value to set

    Returns Vector3

    this

smoothStep

sub

  • Subtract the supplied vector from this one and store the result in this.

    Parameters

    Returns Vector3

    this

  • Decrement the components of this vector by the given values.

    Parameters

    • x: number

      the x component to subtract

    • y: number

      the y component to subtract

    • z: number

      the z component to subtract

    • Optional dest: Vector3

    Returns Vector3

    this

toBlockLocation

  • toBlockLocation(): BlockLocation

toLocation

  • toLocation(): Location

toString

  • toString(formatter?: (x: number, place: "x" | "y" | "z") => string): string
  • Return a string representation of this vector.

    Parameters

    • Optional formatter: (x: number, place: "x" | "y" | "z") => string
        • (x: number, place: "x" | "y" | "z"): string
        • Parameters

          • x: number
          • place: "x" | "y" | "z"

          Returns string

    Returns string

    the string representation

trunc

zero

Static distance

  • distance(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number
  • Return the distance between (x1, y1, z1) and (x2, y2, z2).

    Parameters

    • x1: number

      the x component of the first vector

    • y1: number

      the y component of the first vector

    • z1: number

      the z component of the first vector

    • x2: number

      the x component of the second vector

    • y2: number

      the y component of the second vector

    • z2: number

      the z component of the second vector

    Returns number

    the euclidean distance

Static distanceSquared

  • distanceSquared(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number
  • Return the squared distance between (x1, y1, z1) and (x2, y2, z2).

    Parameters

    • x1: number

      the x component of the first vector

    • y1: number

      the y component of the first vector

    • z1: number

      the z component of the first vector

    • x2: number

      the x component of the second vector

    • y2: number

      the y component of the second vector

    • z2: number

      the z component of the second vector

    Returns number

    the euclidean distance squared

Static lengthSquared

  • lengthSquared(x: number, y: number, z: number): number
  • Get the length squared of a 3-dimensional single-precision vector.

    author

    F. Neurath

    Parameters

    • x: number

      The vector's x component

    • y: number

      The vector's y component

    • z: number

      The vector's z component

    Returns number

    the length squared of the given vector

Generated using TypeDoc