libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
CIEPoint Class Reference

A point in the CIE 1931 xy chromaticity diagram. More...

#include <ciepoint.h>

Public Types

using DataType = Array< double, 2 >
 Underlying storage type for the x and y coordinates.
 

Public Member Functions

 CIEPoint (double x=-1.0, double y=-1.0)
 Constructs a CIEPoint with the given chromaticity coordinates.
 
 CIEPoint (const DataType &other)
 Constructs a CIEPoint from raw coordinate data.
 
bool isValid () const
 Checks whether this point lies within valid chromaticity bounds.
 
CIEPoint lerp (const CIEPoint &other, double t) const
 Linearly interpolates between this point and another.
 

Static Public Member Functions

static bool isValidWavelength (double val)
 Checks whether a wavelength is within the visible range.
 
static XYZColor wavelengthToXYZ (double wavelength)
 Converts a wavelength to a CIE XYZ color.
 
static CIEPoint wavelengthToCIEPoint (double wavelength)
 Converts a wavelength to a CIE xy chromaticity point.
 
static CIEPoint colorTempToWhitePoint (double cct)
 Computes the white point for a correlated color temperature.
 

Static Public Attributes

static constexpr double MinWavelength = 360
 Minimum visible wavelength in nanometers.
 
static constexpr double MaxWavelength = 700
 Maximum visible wavelength in nanometers.
 

Detailed Description

A point in the CIE 1931 xy chromaticity diagram.

Represents a two-dimensional chromaticity coordinate (x, y) and provides conversions between wavelengths, correlated color temperatures, and CIE XYZ color space.

Constructor & Destructor Documentation

◆ CIEPoint() [1/2]

CIEPoint::CIEPoint ( double  x = -1.0,
double  y = -1.0 
)
inline

Constructs a CIEPoint with the given chromaticity coordinates.

Parameters
xThe x chromaticity coordinate (default -1.0, indicating invalid).
yThe y chromaticity coordinate (default -1.0, indicating invalid).

◆ CIEPoint() [2/2]

CIEPoint::CIEPoint ( const DataType other)
inline

Constructs a CIEPoint from raw coordinate data.

Parameters
otherThe coordinate array to copy from.

Member Function Documentation

◆ colorTempToWhitePoint()

static CIEPoint CIEPoint::colorTempToWhitePoint ( double  cct)
inlinestatic

Computes the white point for a correlated color temperature.

Uses Bruce Lindbloom's approximation for CCT values between 4000 K and 25000 K. Returns an invalid CIEPoint for out-of-range values.

Parameters
cctThe correlated color temperature in Kelvin.
Returns
The corresponding CIE xy white point, or an invalid CIEPoint.

◆ isValid()

bool CIEPoint::isValid ( ) const
inline

Checks whether this point lies within valid chromaticity bounds.

Returns
True if both coordinates are within the valid CIE xy range.

◆ isValidWavelength()

static bool CIEPoint::isValidWavelength ( double  val)
inlinestatic

Checks whether a wavelength is within the visible range.

Parameters
valThe wavelength in nanometers.
Returns
True if val is between MinWavelength and MaxWavelength inclusive.

◆ lerp()

CIEPoint CIEPoint::lerp ( const CIEPoint other,
double  t 
) const
inline

Linearly interpolates between this point and another.

Parameters
otherThe target CIEPoint.
tInterpolation factor (0.0 = this, 1.0 = other).
Returns
The interpolated CIEPoint.

◆ wavelengthToCIEPoint()

static CIEPoint CIEPoint::wavelengthToCIEPoint ( double  wavelength)
static

Converts a wavelength to a CIE xy chromaticity point.

Parameters
wavelengthThe wavelength in nanometers.
Returns
The corresponding CIEPoint.

◆ wavelengthToXYZ()

static XYZColor CIEPoint::wavelengthToXYZ ( double  wavelength)
static

Converts a wavelength to a CIE XYZ color.

Parameters
wavelengthThe wavelength in nanometers.
Returns
The corresponding XYZColor.

The documentation for this class was generated from the following file: