Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/acoustics/vec3 is the small vector library the room-acoustics DSP nodes share. A vector is three consecutive numbers at an offset in a caller-owned Float64Array, so a list of points is one flat stride-3 buffer. vec3Set, vec3Copy, vec3Add, vec3Sub, vec3Scale, vec3Dot, vec3Cross, vec3Norm, vec3Distance and vec3Normalize replace the Eigen Vector3f operations pyroomacoustics uses, computed in f64 where upstream computes in f32.

const v = new Float64Array(9) // three vectors
vec3Set(v, 0, 1, 0, 0)
vec3Cross(v, 6, v, 0, v, 3) // v[6..8] = v[0..2] × v[3..5]

Lifecycle

None: pure functions over caller-owned buffers, with no state or init step. Writers take (out, outOffset, …) and read every input first, so out may alias an input. Nothing allocates or recurses.

When to use it

Room geometry inside a Processor or a budgeted preparation step, where points, normals and directions live in preallocated typed arrays rather than objects.

Limits

  • f64 throughout; results differ from upstream's f32 in the low bits.
  • vec3Normalize divides by the length, as Eigen does, and copies a zero-length vector unchanged.
  • Offsets are not bounds-checked; the caller sizes the buffers.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

Used by