photometrics.package
This package holds more than this page lists. See all of its files in its world.
README.md
ies module
Reads an IESNA LM-63 photometric file and rasterizes its vertical distribution into a layer of the shared feature-texture array.
parse(src) returns the candela values, the vertical angle each was measured
at, and the distribution's peak. A file whose header, angle counts, vertical
angles (ascending, as LM-63 lists them) or candela block do not agree returns
nil and a reason naming which.
toLayer(profile, layer, coneHalfAngleDeg, resolution?) fills a layer with the
curve. A spot light projects its cookie through a perspective frustum whose half
field of view is the cone's half angle (held between 0.01 radians and 85
degrees), so the image edge is the cone edge and a texel at radius r from the centre lights the direction
atan(r * tan(coneHalfAngleDeg)) from the axis. Each texel holds the candela the
file states at that angle, interpolated between the two vertical angles either
side of it and normalized against the peak; a direction outside the file's first
and last vertical angle receives none. Pointing a spot light's cookieLayer at
that layer projects the distribution through its cone. A profile holding fewer
than two samples, a different number of candela values and angles, or angles
out of ascending order returns nil and a reason naming which.
The vertical angles are read as Type C states them, 0 along the luminaire's axis, and may be spaced however the file spaces them: fine steps through the beam and coarse ones outside it, or a span such as 90 to 180 that starts away from the axis.
Normalizing against the peak keeps the two concerns apart — the texture carries the distribution's shape, and the light's own brightness carries its exposure. Two fixtures with the same beam shape and different output share a profile.
Only the vertical distribution is used. A cookie is one image projected through the cone, which can express a distribution varying with angle from the axis but not one that also varies with rotation around it; a file whose horizontal planes differ is sampled at its first.