Mathematical functions and types for working with vectors
A small, allocation-conscious set of vector primitives and operations used by the
math modules (eg. matrix and quat) and by geometry/transforms across
the SDK.
Vectors are represented as either typed arrays (eg. Float32Array, Float64Array,
Int32Array, …) or fixed-length numeric tuples. All functions accept either form
and generally support an optional dest parameter to write results in-place, which
helps avoid temporary allocations in tight loops.
Factory helpers like createVec3Float64 and createVec4Float32
produce typed arrays of the requested size/precision, optionally seeded from an
existing vector.
Many functions default to mutating their first input (eg. addVec3(u, v) writes into u)
unless a dest is provided. If you need to keep inputs unchanged, always pass an explicit
destination vector.
xeokit Vector Math Utilities
Mathematical functions and types for working with vectors
A small, allocation-conscious set of vector primitives and operations used by the math modules (eg. matrix and quat) and by geometry/transforms across the SDK.
Vectors are represented as either typed arrays (eg.
Float32Array,Float64Array,Int32Array, …) or fixed-length numeric tuples. All functions accept either form and generally support an optionaldestparameter to write results in-place, which helps avoid temporary allocations in tight loops.Vector type system
This module defines vector aliases grouped by:
Float32/Float64or “either precision”Notable aliases:
Factory helpers like createVec3Float64 and createVec4Float32 produce typed arrays of the requested size/precision, optionally seeded from an existing vector.
Core operations
Mutability and destinations
Many functions default to mutating their first input (eg.
addVec3(u, v)writes intou) unless adestis provided. If you need to keep inputs unchanged, always pass an explicit destination vector.