rhodonite
    Preparing search index...

    Class MutableVector3

    Mutable 3D vector class with 32-bit float precision. Provides in-place vector operations for efficient mathematical computations. All operations modify the vector instance and return it for method chaining.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _v: TypedArray = ...

    Internal typed array storage for vector components

    Accessors

    • get className(): string

      Gets the class name for debugging purposes.

      Returns string

      The class name string

    • get glslStrAsFloat(): string

      Gets the GLSL representation of this vector as a float vec3.

      Returns string

      A string representation suitable for GLSL shaders

    • get glslStrAsInt(): string

      Gets the GLSL representation of this vector as an integer ivec3.

      Returns string

      A string representation suitable for GLSL shaders with integer components

    • get glslStrAsUint(): string

      Gets the GLSL string representation of the vector as unsigned integer values.

      Returns string

      GLSL-formatted string for unsigned integer values with 'u' suffix

      Error - Must be implemented by subclasses

    • get wgslStrAsFloat(): string

      Gets the WGSL representation of this vector as a float vec3f.

      Returns string

      A string representation suitable for WGSL shaders

    • get wgslStrAsInt(): string

      Gets the WGSL representation of this vector as an integer vec3i.

      Returns string

      A string representation suitable for WGSL shaders with integer components

    • get wgslStrAsUint(): string

      Gets the WGSL string representation of the vector as unsigned integer values.

      Returns string

      WGSL-formatted string for unsigned integer values with 'u' suffix

      Error - Must be implemented by subclasses

    • get compositionType(): CompositionTypeClass<"VEC3">

      Gets the composition type for this vector class.

      Returns CompositionTypeClass<"VEC3">

      The composition type (Vec3)

    Methods

    • Gets the component at the specified index.

      Parameters

      • i: number

        The index (0 for x, 1 for y, 2 for z)

      Returns number

      The component value at the specified index

    • Checks if this vector is approximately equal to another vector within a tolerance.

      Parameters

      • vec: IVector3

        The vector to compare with

      • delta: number = Number.EPSILON

        The tolerance for comparison (default: Number.EPSILON)

      Returns boolean

      True if vectors are approximately equal, false otherwise

    • Checks if the internal storage shares the same ArrayBuffer as the provided one. Useful for determining if vectors share underlying memory.

      Parameters

      • arrayBuffer: ArrayBuffer

        The ArrayBuffer to compare against

      Returns boolean

      True if the same ArrayBuffer is used, false otherwise

    • Calculates the squared length of the vector. This is more efficient than calculating the actual length when only comparison is needed.

      Returns number

      The squared length of the vector

    • Gets the component value at the specified index. Alias for the at() method for convenience.

      Parameters

      • i: number

        The index of the component to retrieve

      Returns number

      The component value at the given index

    • Calculates the squared length of a vector (static version). This is more efficient than calculating the actual length when only comparison is needed.

      Parameters

      • vec: IVector3

        The vector to calculate squared length for

      Returns number

      The squared length of the vector

    • Rotates a vector around the X-axis and stores the result in the output vector. Only the Y and Z components are affected by X-axis rotation.

      Parameters

      • vec3: IVector3

        The input vector to rotate

      • radian: number

        The rotation angle in radians

      • outVec: MutableVector3

        The output vector to store the result

      Returns void

    • Rotates a vector around the Y-axis and stores the result in the output vector. Only the X and Z components are affected by Y-axis rotation.

      Parameters

      • vec3: IVector3

        The input vector to rotate

      • radian: number

        The rotation angle in radians

      • outVec: MutableVector3

        The output vector to store the result

      Returns void

    • Rotates a vector around the Z-axis and stores the result in the output vector. Only the X and Y components are affected by Z-axis rotation.

      Parameters

      • vec3: IVector3

        The input vector to rotate

      • radian: number

        The rotation angle in radians

      • outVec: MutableVector3

        The output vector to store the result

      Returns void