Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines a 3-component vector with X,Y,Z values

Hierarchy

  • Vector3

Index

Constructors

constructor

  • new Vector3(x: number, y: number, z: number): Vector3
  • Creates a 3-component vector with X,Y,Z values

    Parameters

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

    Returns Vector3

Accessors

length

  • get length(): number
  • Gets the euclidean length of the vector

    Returns number

x

  • get x(): number
  • Gets the X-value

    remarks

    Warning! Treat Vector3 as immutable! Do not set this value but create new vectors if you need to change a value

    Returns number

y

  • get y(): number
  • Gets the Y-value

    remarks

    Warning! Treat Vector3 as immutable! Do not set this value but create new vectors if you need to change a value

    Returns number

z

  • get z(): number
  • Gets the Z-value

    remarks

    Warning! Treat Vector3 as immutable! Do not set this value but create new vectors if you need to change a value

    Returns number

Static zero

  • Returns a static shared zero vector where X,Y,Z = 0

    Returns Vector3

Methods

add

  • Performs vector addition of this + other, returning the result in a new vector

    description

    An example can be found below

    const firstVector = new Vector3(1,2,3);
    const secondVector = new Vector3(1,1,1);
    const result = firstVector.add(secondVector);
    // Result is [2,3,4]

    Parameters

    • other: Vector3

      the vector to add to this vector

    Returns Vector3

    A new vector with the addition result

crossProduct

  • Performs vector cross product of this vector and another vector, returning the result in a new vector

    description

    An example can be found below

    const firstVector = new Vector3(1,2,3);
    const secondVector = new Vector3(4,5,6);
    const result = firstVector.crossProduct(secondVector);
    // Result is firstVector ^ (cross) secondVector

    Parameters

    • rhs: Vector3

      the other vector to apply to the right hand side of the cross product

    Returns Vector3

    A new vector with the cross product result

dotProduct

  • Performs vector dot product of this vector and another vector, returning the result as a scalar

    Parameters

    • rhs: Vector3

      the other vector to apply to the right hand side of the dot product

    Returns number

normalize

  • normalize(): void
  • Normalizes the current vector by computing its X,Y,Z components which make the length = 1 but direction the same

    remarks

    This is the only operation which modifies the current vector (not immutable)

    Returns void

scalarMultiply

  • scalarMultiply(scalar: number): Vector3
  • Performs scalar multiplication of this vector x scalar constant, returning the result in a new vector

    description

    An example can be found below

    const firstVector = new Vector3(1,2,3);
    const result = firstVector.scalarMultiply(2);
    // Result is [2,4,6]

    Parameters

    • scalar: number

    Returns Vector3

    A new vector with the multiply result

subtract

  • Performs vector subtraction of this - other, returning the result in a new vector

    description

    An example can be found below

    const firstVector = new Vector3(1,2,3);
    const secondVector = new Vector3(1,1,1);
    const result = firstVector.subtract(secondVector);
    // Result is [0,1,2]

    Parameters

    • other: Vector3

      the vector to substract from this vector

    Returns Vector3

    A new vector with the subtraction result

toString

  • toString(): string
  • Returns a string representation of the vector for debugging purposes

    Returns string

toTsrVector3

  • toTsrVector3(webAssemblyContext: TSciChart3D): TSRVector3
  • Used internally - converts the Vector3 to a {@link TSRVector3} for compatibility with SciChart's webassembly engine

    Parameters

    Returns TSRVector3

Generated using TypeDoc