gpu-curtains
    Preparing search index...

    Class Vec3

    Really basic 3D vector class used for vector calculations.

    Index

    Constructors

    • Vec3 constructor

      Parameters

      • x: number = 0

        X component of our Vec3.

      • y: number = x

        Y component of our Vec3.

      • z: number = x

        Z component of our Vec3.

      Returns Vec3

    Properties

    type: string

    The type of the Vec3.

    Accessors

    Methods

    • Called when at least one component of the Vec3 has changed.

      Parameters

      • callback: () => void

        Callback to run when at least one component of the Vec3 has changed.

      Returns Vec3

    • Set the Vec3 from values.

      Parameters

      • x: number = 0

        New X component to set.

      • y: number = x

        New Y component to set.

      • z: number = x

        New Z component to set.

      Returns Vec3

      • This Vec3 after being set.
    • Add a scalar to all the components of this Vec3.

      Parameters

      • value: number = 0

        Number to add.

      Returns Vec3

      • This Vec3 after addition.
    • Subtract a scalar to all the components of this Vec3.

      Parameters

      • value: number = 0

        Number to subtract.

      Returns Vec3

      • This Vec3 after subtraction.
    • Multiply all components of this Vec3 with a scalar.

      Parameters

      • value: number = 1

        Number to multiply with.

      Returns Vec3

      • This Vec3 after multiplication.
    • Divide all components of this Vec3 with a scalar.

      Parameters

      • value: number = 1

        number to divide with.

      Returns Vec3

      • This Vec3 after division.
    • Get the euclidian distance between this Vec3 and another Vec3.

      Parameters

      • vector: Vec3 = ...

        Vec3 to use for distance calculation.

      Returns number

      • Euclidian distance.
    • Calculate the linear interpolation of this Vec3 by given Vec3 and alpha, where alpha is the percent distance along the line.

      Parameters

      • vector: Vec3 = ...

        Vec3 to interpolate towards.

      • alpha: number = 1

        Interpolation factor in the [0, 1] interval.

      Returns Vec3

      • This Vec3 after linear interpolation.
    • Rotate a Vec3 around and axis by a given angle.

      Parameters

      • axis: Vec3 = ...

        Normalized Vec3 around which to rotate.

      • angle: number = 0

        Angle (in radians) to rotate.

      • quaternion: Quat = ...

        Optional quaternion to use for rotation computations.

      Returns Vec3

      • This Vec3 with the rotation applied.
    • Transforms the direction of this vector by a Mat4 (the upper left 3 x 3 subset) and then normalizes the result.

      Parameters

      • matrix: Mat4

        Mat4 to use for transformation.

      Returns Vec3

      • This Vec3 with the transformation applied.