Stores and manipulates a threedimensional vector comprised of the components x, y and z

           +y
            |__ +x
           /
         +z   

Authors

Jascha Karagöl, HFU, 2019 | Jirka Dell'Oro-Friedl, HFU, 2019-2022 | Jonas Plotzky, HFU, 2023

Hierarchy (view full)

Implements

Constructors

Accessors

  • get magnitudeSquared(): number
  • Returns the square of the magnitude of the vector without calculating a square root. Faster for simple proximity evaluation.

    Returns number

  • get type(): string
  • Retrieves the type of this mutable subclass as the name of the runtime class

    Returns string

    The type of the mutable

Methods

  • Returns true if the coordinates of this and the given vector are to be considered identical within the given tolerance TODO: examine, if tolerance as criterium for the difference is appropriate with very large coordinate values or if _tolerance should be multiplied by coordinate value

    Parameters

    • _compare: Vector3
    • _tolerance: number = Number.EPSILON

    Returns boolean

  • Collect applicable attributes of the instance and copies of their values in a Mutator-object. By default, a mutator cannot be extended, since extensions are not available in the object the mutator belongs to. A mutator may be reduced by the descendants of Mutable to contain only the properties needed.

    Returns Mutator

  • Returns true if the position described by this is within a cube with the opposite corners 1 and 2

    Parameters

    Returns boolean

  • Returns true if the position described by this is within a sphere with the given center and radius

    Parameters

    Returns boolean

  • Uses the standard array.map functionality to perform the given function on all components of this vector and return a new vector with the results

    Parameters

    • _function: ((value, index, array) => number)
        • (value, index, array): number
        • Parameters

          • value: number
          • index: number
          • array: Float32Array

          Returns number

    Returns Vector3

  • Updates the attribute values of the instance according to the state of the mutator. The mutation may be restricted to a subset of the mutator and the event dispatching suppressed. Uses mutateBase, but can be overwritten in subclasses

    Parameters

    Returns Promise<void>

  • Normalizes this to the given length, 1 by default

    Parameters

    • _length: number = 1

    Returns void

  • Defines the components of this vector with the given numbers

    Parameters

    • _x: number = 0
    • _y: number = 0
    • _z: number = 0

    Returns void

  • Transforms this vector by the given matrix or rotation quaternion. Including or exluding the translation if a matrix is passed. Including is the default, excluding will only rotate and scale this vector.

    Parameters

    Returns void

  • Creates a cartesian vector from geographic coordinates

    Parameters

    • _longitude: number = 0
    • _latitude: number = 0
    • _magnitude: number = 1

    Returns Vector3

  • Calculates and returns the reflection of the incoming vector at the given normal vector. The length of normal should be 1. __________________ /|
    incoming / | \ reflection / | \
    normal

    Parameters

    Returns Vector3