Documentation
¶
Overview ¶
Package bands is light carried as amounts in slices of the spectrum: the form a renderer needs when light has to be added, filtered, redshifted or bent by wavelength, before an eye reduces it to three numbers.
Light in bands is what light is, coarsely. What it looks like is a colour, and colour is libtheme's: its bands package folds this light into a swatch through the 1931 observer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Band ¶
type Band int
Band is one slice of the spectrum. Band i runs from 2^(i/PerOctave) nanometres up to, but not including, 2^((i+1)/PerOctave). Band 0 starts at one nanometre, and the wavelength doubles every PerOctave bands. Visible light is about bands 205 to 230.
func PerOctave ¶
func PerOctave() Band
PerOctave is how many bands there are for every doubling of wavelength. It is picked, not derived, and is the one number this package takes; celestial's research data holds it, and says who picked it and from what.
The bands are even in the logarithm of wavelength, not in nanometres. Redshift multiplies every wavelength by the same factor, so it is a slide along the bands, not a resampling.
type Light ¶
type Light struct {
// contains filtered or unexported fields
}
Light is the power in each of a run of neighbouring bands, starting at band first. Its units are whatever the spectrum it came from used, times a nanometre. The zero value is no light.
func Lines ¶
Lines is light given at any wavelengths, each a line, grouped into the bands by wavelength in nanometres. Gamma rays are a few thousandths of a nanometre, and they have bands too.
func Lit ¶
Lit is light after a share of it: in every band, the light's power times the part passed there. No share at all passes nothing, as the zero Share does.
func Split ¶
Split is a spectrum, given as power by wavelength in nanometres, as light in bands: each wavelength's power goes into the band it falls in.
Every wavelength counts, including those an eye never sees. Light in infrared bands is still light.
type Share ¶
type Share struct {
// contains filtered or unexported fields
}
Share is the fraction of light passed in each of a run of bands: what a filter lets through, or what a surface sends back. It is not light. Light arriving and a share of it are different things, so they are different types, and Lit is the one way to put them together.
Outside its run a share passes nothing, unless it was made Even, which passes the same part in every band. The zero value passes nothing.
func Even ¶
Even is a share that passes the same part of the light in every band: a grey filter, or a perfectly grey surface. It refuses a part that is not a fraction, and then gives no share.
func Shares ¶
Shares is a share given as the part passed at wavelengths in nanometres, as measured: a reflectance or transmittance curve. It refuses no wavelengths at all, a wavelength not longer than nothing and a part that is not a fraction, and then gives no share.
A band's part is the mean of the wavelengths given in it, since a share is a fraction and fractions do not add. A band inside the run with none given takes the straight line between its neighbours, read at its centre. Outside the run nothing passes.