Documentation
¶
Overview ¶
Package bands carries light as amounts in logarithmic wavelength bins. A renderer can add, filter, or shift the spectrum before reducing it to colour. Infrared and radio power count as light here too.
This is a coarse spectral representation, not a colour model. Colour conversion belongs to libtheme and its CIE 1931 observer integration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Band ¶
type Band int
Band identifies a half-open wavelength bin. Bin i spans [2^(i/PerOctave), 2^((i+1)/PerOctave)) nanometres. Band zero begins at 1 nm; wavelengths double every PerOctave bins. At the chosen spacing, visible light occupies roughly bands 205–230.
type Light ¶
type Light struct {
// contains filtered or unexported fields
}
Light stores power over consecutive wavelength bands, beginning at first. Units follow the input spectrum integrated over nanometres. The zero value contains no light.
func Lines ¶
Lines groups power at arbitrary wavelengths in nanometres into bands. Unlike Split, it retains sub-nanometre line positions, including gamma rays.
func Lit ¶
Lit returns band power multiplied by the corresponding transmission or reflectance fraction. A nil share, like the zero Share, passes no light. The input spectrum is not modified.
func Split ¶
Split groups a spectrum sampled at integer nanometres into bands, adding each sample to its containing band. Wavelengths outside human vision are retained.
type Share ¶
type Share struct {
// contains filtered or unexported fields
}
Share represents transmission or reflectance fractions, not emitted light. Lit applies it to a spectrum. A finite curve passes nothing outside its stored bands; Even applies a fraction everywhere. The zero value transmits nothing.
func Even ¶
Even constructs a wavelength-independent fraction, like a grey filter or neutral surface. Invalid fractions return an error.
func Shares ¶
Shares constructs transmission or reflectance from samples at integer nanometres. Empty samples, nonpositive wavelengths, or fractions outside [0, 1] return an error and no share.
Samples within a band are averaged, not summed. Unsampled bands inside the run interpolate between neighbouring measurements at the band centre. Outside the sampled run, no light passes.