pub struct OptimalColors(/* private fields */);Expand description
Represents the set of optimal colors in colorimetry.
Optimal colors define the theoretical limits of color saturation (chroma) for given lightness and hue values. They are based on binary reflectance spectra that reflect either 0% or 100% of light at each wavelength, representing the most vivid colors physically possible under the constraints of human vision.
These colors form the boundary of the CIE color spaces (such as CIE 1931 or CIELAB), and are used to compute:
- The spectral locus in chromaticity diagrams.
- The maximum chroma values at given lightness and hue levels in perceptual spaces like CIELAB.
Although optimal colors do not correspond to real-world pigments or displays, they are essential for defining the theoretical gamut of visible colors.
Implementations§
Source§impl OptimalColors
impl OptimalColors
Sourcepub fn new(observer: Observer, ref_white: CieIlluminant) -> OptimalColors
pub fn new(observer: Observer, ref_white: CieIlluminant) -> OptimalColors
Computes the optimal colors for the observer under the specified reference white.
The resulting OptimalColors contains a matrix of tristimulus values
derived from optimal spectra.
§Arguments
ref_white- The reference white illuminant to use for the calculations.
§Returns
OptimalColors- A struct containing the reference white and the matrix of optimal colors.
§Notes
- The optimal colors are computed by applying a rectangular filter to the spectral locus, simulating the addition of contiguous spectral bands with increasing width.
- Each row in the resulting matrix corresponds to a different filter width, and the filter wraps around the spectrum to ensure continuity and to represent the full range of possible colors.
- The number of spectral samples,
NS, is fixed at 401 throughout the library.- The resulting matrix has shape
(NS-1, NS)= (400, 401). - Each column corresponds to a starting wavelength, and each row to a filter width.
- The resulting matrix has shape
- This is a theoretical construct and may not correspond to physically realizable colors.
- As it calculates about 160,000 colors, it may be computationally intensive.
pub fn white_point(&self) -> XYZ
pub fn colors(&self) -> &DMatrix<Vector3<f64>>
pub fn observer(&self) -> Observer
Auto Trait Implementations§
impl Freeze for OptimalColors
impl RefUnwindSafe for OptimalColors
impl Send for OptimalColors
impl Sync for OptimalColors
impl Unpin for OptimalColors
impl UnsafeUnpin for OptimalColors
impl UnwindSafe for OptimalColors
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.