Skip to content

SphereLayout

Source: SphereLayout.h

SphereLayout

class SphereLayout
src/light/layouts/SphereLayout.h:19

Inherits: LayoutBase

Layout mapping LEDs onto a sphere surface.

Author: MoonLight, https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Layouts/L_MoonLight.h

Public Attributes

lengthType radius = 4 : The shell's radius in light-units, its maximum keeping the lattice scan bounded.

Public Methods

virtual inline const char * tags() const override : The catalog tags this layout carries.

virtual inline Dim dimensions() const override : How many axes this layout places lights on.

virtual inline void defineControls() override : The controls a user sets on the card.

virtual inline nrOfLightsType lightCount() const override : How many lights the current settings place.

virtual inline void placeLights(const CoordSink & sink) const override : Emit every light's coordinate, in wiring order.

More info

A hollow sphere: lights sit on the surface only (a one-light-thick shell), not the interior. Lattice layout, every light is at an integer (x,y,z) in a (2r+1)^3 bounding box, centerd at (r,r,r). A lattice point is on the shell when its distance from the center rounds to radius, i.e. it falls in the half-open band [radius-0.5, radius+0.5). The same band predicate drives both [lightCount()] (count) and [placeLights()] (emit), so they never disagree.

Distances are compared squared, so there is no square root or float per light. The hot-path discipline applies here even though layout iteration is cold, because the same pattern then reads uniformly across the codebase.