IsWithinMacAdamLimits {munsellinterpol} | R Documentation |
Test xyY Coordinates for being Inside the MacAdam Limits
Description
Test xyY Coordinates for being Inside the MacAdam Limits for Illuminants C and D65
Usage
IsWithinMacAdamLimits( xyY, Illuminant='C' )
Arguments
xyY |
a numeric Nx3 matrix with CIE xyY coordinates in the rows, or a vector that can be converted to such a matrix, by row. The reference white is asssumed to have Y=100. |
Illuminant |
either |
Details
The MacAdam Limit is the boundary of the optimal color solid (also called the Rösch Farbkörper), in XYZ coordinates. The optimal color solid is convex and depends on the illuminant. Points on the boundary of the solid are called optimal colors. It is symmetric about the midpoint of the segment joining black and white (the 50% gray point). It can be expressed as a zonohedron - a convex polyhedron with a special form; for details on zonohedra, see Centore.
For each of the 2 illuminants, a zonohedron Z
is pre-computed
(and stored in sysdata.rda
).
The wavelengths used are 380 to 780 nm with 5nm step (81 wavelengths).
Each zonohedron has 81*80=6480 parallelogram faces, though some of them are coplanar.
Z
is expressed as the intersection of 6480 halfspaces.
The plane equation of each parallelogram is pre-computed,
but redundant ones are not removed (in this version).
For testing a query point xyY, a pseudo-distance metric \delta
is used.
Let the zonohedron Z
be the intersection of the halfspaces
⟨ h_i,x
⟩ \le b_i ~~ i=1,...,n
,
where each h_i
is a unit vector.
The point xyY is converted to XYZ, and \delta
(XYZ) is computed as:
\delta
(XYZ) := max( ⟨ h_i
,XYZ ⟩ - b_i
)
where the maximum is taken over all i=1,...,n
.
This calculation can be optimized;
because the zonohedron is centrally symmetric, only half of the planes actually have to be stored,
and this cuts the memory and processing time in half.
It is clear that XYZ is within the zonohedron iff \delta
(XYZ) \le
0,
and that XYZ is on the boundary iff \delta
(XYZ)=0.
This pseudo-distance is part of the returned data.frame
.
An interesting fact is that if \delta
(XYZ)>0,
then \delta
(XYZ) \le
dist(XYZ,Z
),
with equality iff the segment from XYZ
to the
point z
on the boundary of Z
closest to XYZ is
normal to one of the faces of Z
that contains z
.
This is why we call \delta
a pseudo-distance.
Another interesting fact is that if \delta
(XYZ) \le
0,
then \delta
(XYZ) = -min( \Psi_Z(u)
- ⟨ u
,XYZ ⟩ ),
where the minimum is taken over all unit vectors u
and
where \Psi_Z
is the support function of Z
.
Value
A data.frame
with N rows and these columns:
within |
a logical which is |
delta |
the pseudo-distance |
The row names of the output value are set equal to the row names of xyY
.
Author(s)
Glenn Davis and Jose Gama
References
Centore, Paul. A zonohedral approach to optimal colours. Color Research & Application. Vol. 38. No. 2. pp. 110-119. April 2013.
Rösch, S. Darstellung der Farbenlehre für die Zwecke des Mineralogen. Fortschr. Mineral. Krist. Petrogr. Vol. 13 No. 143. 1929.
MacAdam, David L. Maximum Visual Efficiency of Colored Materials. Journal of the Optical Society of America. Vol 25, No. 11. pp. 361-367. November 1935.
Wikipedia. Support Function. https://en.wikipedia.org/wiki/Support_function
Examples
IsWithinMacAdamLimits( c(0.6,0.3,10, 0.6,0.3,20, 0.6,0.3,30, 0.6,0.3,40 ), 'C' )
## within delta
## 1 TRUE -1.941841
## 2 TRUE -1.332442
## 3 FALSE 3.513491
## 4 FALSE 12.826172