Build with this node

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

Ask Studio

@maruaudio/dsp/acoustics/wall is one planar polygon wall of a 3-D room, with its per-band absorption and scattering, ported from pyroomacoustics' libroom wall.cpp. It computes the wall's normal, in-plane basis, flat corners and area, and answers a room model's queries: segment intersection with a code, point reflection, side, sameness, mirrored points and directions, and the cosine of the angle to a point. The normal is Newell's sum and the basis a Gram-Schmidt frame turned onto the corners' principal axes, replacing upstream's SVD.

Parameters

CallAcceptsDefault
createWall(capacity)3 to 1,024 corners, else RangeError64 (a shoebox passes 4)
initWall3d(wall, corners, offset, n, absorption, scatter)3 ≤ n ≤ capacity; 1 to 9 bands, the two arrays the same length; planar within 1e-5 mnone

It returns 0 or a code (1 bad corners, 2 bad bands, 3 band mismatch, 4 not planar, 5 degenerate), after which the state is unusable. Per band it stores energy reflection 1 − α, amplitude transmission √(1 − α) and the mean scattering.

Lifecycle

createWall allocates once (control-plane setup) → initWall3d fills or re-fills it in place, copying the corners → queries, allocation-free.

When to use it

Building the walls of a room for image-source or ray-traced simulation, where reflections and visibility need libroom's exact intersection codes.

Limits

  • 3-D only: 2-D walls, Lambertian sampling and broadcast_bands_to are not ported. Codes, areas, points, reflections and side match upstream; raw flat coordinates match only up to a quarter turn.
  • wallIntersection may write out even when it returns no intersection; read it only for codes 0 to 3. wallSameAs ignores absorption and scattering, as upstream does.
  • Planarity is checked per corner, so near 1e-5 m it can differ from upstream's singular-value test.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

Used by