SliceCache class

Per-tone cache of the sRGB gamut slice's chromaticity boundary.

Answers queries against one object: "the set of u'v' chromaticities renderable at tone T". The boundary is sampled once per tone (360 HCT solves); queries are polyline arithmetic plus a small local refinement (~46 solves, ~40us).

Refinement effort (iteration counts below) was chosen by sweeping the full RGB cube; error is mix-to-neutral deviation in u'v' (JND ~ 0.004):

config p95 max %<JND us/call c16 h4,1x10 p8 0.00120 0.00505 99.9 108 c12 h4,1x8 p8 0.00127 0.00483 99.9 86 c8 h4x6 p4 0.00149 0.00483 99.9 42 <- shipped c6 h4x5 p4 0.00170 0.00483 99.9 34 c4 h4x4 p2 0.00206 0.00806 99.6 24

Max error is identical from ceiling to minimal: it is a gamut-clamping floor that more iterations cannot buy back. The shipped config sits well above the accuracy cliff (which begins at c4/h4/p2) at half the cost of the conservative config.

Properties

hashCode → int
The hash code for this object.
no setterinherited
maxChromas → List<double>
Boundary chromaticity u', v', and max chroma, indexed by hue degree.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tone → double
The (quantized) tone this slice was sampled at.
final
us → List<double>
Boundary chromaticity u', v', and max chroma, indexed by hue degree.
final
vs → List<double>
Boundary chromaticity u', v', and max chroma, indexed by hue degree.
final

Methods

nearest(double tu, double tv) → Hct
In-gamut color at tone whose chromaticity is nearest (tu, tv).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rayExit(double du, double dv) → (double, double)?
Walks boundary segments to find where the ray white + s*(du, dv) exits the slice. Returns (s, hueIndex + fraction), or null if the slice is degenerate (tone ~0 or ~100, or a zero direction).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

of(double rawTone) → SliceCache
The slice for rawTone.