rhodonite
    Preparing search index...

    Class MutableScalarD

    Mutable scalar class with 64-bit float components. This class provides a mutable scalar value backed by a Float64Array for higher precision.

    Hierarchy (View Summary)

    Index
    _v: TypedArray = ...

    Internal typed array storage for vector components

    • get bytesPerComponent(): number

      Gets the number of bytes per component in the underlying typed array.

      Returns number

      The number of bytes per element

    • get className(): string

      Gets the class name of this vector instance.

      Returns string

      The constructor name of the class

    • get glslStrAsFloat(): string

      Gets the scalar value as a GLSL-compatible float string.

      Returns string

      The scalar value formatted as a GLSL float literal

    • get glslStrAsInt(): string

      Gets the scalar value as a GLSL-compatible integer string.

      Returns string

      The scalar value formatted as a GLSL integer literal

    • get glslStrAsUint(): string

      Gets the scalar value as a GLSL-compatible unsigned integer string.

      Returns string

      The scalar value formatted as a GLSL unsigned integer literal with 'u' suffix

    • get raw(): TypedArray

      Gets the raw typed array containing the scalar value.

      Returns TypedArray

      The underlying typed array

    • get w(): number

      Gets the w component (always 1 for scalars).

      Returns number

      Always returns 1

    • get wgslStrAsFloat(): string

      Gets the scalar value as a WGSL-compatible float string.

      Returns string

      The scalar value formatted as a WGSL float literal

    • get wgslStrAsInt(): string

      Gets the scalar value as a WGSL-compatible integer string.

      Returns string

      The scalar value formatted as a WGSL integer literal

    • get wgslStrAsUint(): string

      Gets the scalar value as a WGSL-compatible unsigned integer string.

      Returns string

      The scalar value formatted as a WGSL unsigned integer literal with 'u' suffix

    • get x(): number

      Gets the x component (scalar value).

      Returns number

      The scalar value

    • set x(x: number): void

      Sets the x component (scalar value).

      Parameters

      • x: number

        The new scalar value

      Returns void

    • get y(): number

      Gets the y component (always 0 for scalars).

      Returns number

      Always returns 0

    • get z(): number

      Gets the z component (always 0 for scalars).

      Returns number

      Always returns 0

    • get compositionType(): CompositionTypeEnum

      Gets the composition type for this scalar.

      Returns CompositionTypeEnum

      The scalar composition type

    • Gets the component value at the specified index.

      Parameters

      • i: number

        The index of the component to retrieve

      Returns number

      The component value at the given index

    • Creates a copy of this scalar.

      Returns MutableScalarD

      A new MutableScalarD instance with the same value

    • Copies the components from another scalar to this scalar.

      Parameters

      • vec: Scalar_<Float64ArrayConstructor>

        The source scalar to copy from

      Returns void

    • Calculates the dot product between this vector and another vector.

      Parameters

      Returns number

      The dot product result

      Error - Must be implemented by subclasses

    • Converts the vector to a flat array of numbers.

      Returns number[]

      Array containing all vector components

      Error - Must be implemented by subclasses

    • Gets the scalar value as a number.

      Returns number

      The scalar value

    • Gets the scalar value wrapped in an array.

      Returns number[]

      An array containing the scalar value

    • Checks if this vector is a dummy (empty) vector. A dummy vector has no components and is typically used as a placeholder.

      Returns boolean

      True if the vector is dummy, false otherwise

    • Performs approximate equality comparison with another scalar within a tolerance.

      Parameters

      • scalar: Scalar_<Float64ArrayConstructor>

        The scalar to compare with

      • delta: number = Number.EPSILON

        The tolerance for comparison (default: Number.EPSILON)

      Returns boolean

      True if the scalars are equal within the specified tolerance

    • Performs strict equality comparison with another scalar. Uses exact floating-point comparison without tolerance.

      Parameters

      • scalar: Scalar_<Float64ArrayConstructor>

        The scalar to compare with

      Returns boolean

      True if the scalars are exactly 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 length (magnitude) of the vector.

      Returns number

      The length of the vector

      Error - Must be implemented by subclasses

    • Calculates the squared length of the vector. This is more efficient than length() when only relative comparisons are needed.

      Returns number

      The squared length of the vector

      Error - Must be implemented by subclasses

    • Calculates the distance from this vector to another vector.

      Parameters

      Returns number

      The distance between the vectors

      Error - Must be implemented by subclasses

    • Sets the scalar value.

      Parameters

      • value: number

        The new scalar value

      Returns MutableScalarD

      This scalar instance for method chaining

    • Converts the scalar to a string representation.

      Returns string

      A string representation of the scalar in the format "(value)"

    • Converts the vector to an approximate string representation. Useful for debugging when exact precision is not required.

      Returns string

      Approximate string representation of the vector

      Error - Must be implemented by subclasses

    • 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

    • Creates a dummy scalar with no data.

      Returns MutableScalarD

      A new MutableScalarD instance with empty array

    • Creates a scalar with value 1.

      Returns MutableScalarD

      A new MutableScalarD instance with value 1

    • Creates a scalar with value 0.

      Returns MutableScalarD

      A new MutableScalarD instance with value 0