IsWithinMacAdamLimits: Test xyY Coordinates for being Inside the MacAdam Limits

View source: R/optimals.R

IsWithinMacAdamLimitsR 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 'C' or 'D65'. Partial matching is enabled, and is case-insensitive.

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 δ is used. Let the zonohedron Z be the intersection of the halfspaces \langle h_i,x \rangle ≤ b_i ~~ i=1,...,n, where each h_i is a unit vector. The point xyY is converted to XYZ, and δ(XYZ) is computed as: δ(XYZ) := max( \langle h_i,XYZ \rangle - 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 δ(XYZ) 0, and that XYZ is on the boundary iff δ(XYZ)=0. This pseudo-distance is part of the returned data.frame.

An interesting fact is that if δ(XYZ)>0, then δ(XYZ) 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 δ a pseudo-distance. Another interesting fact is that if δ(XYZ) 0, then δ(XYZ) = -min( Ψ_Z(u) - \langle u,XYZ \rangle ), where the minimum is taken over all unit vectors u and where Ψ_Z is the support function of Z.

Value

A data.frame with N rows and these columns:

within

a logical which is TRUE iff the corresponding row in xyY is inside the optimal color solid for the illuminant. If a point is exactly on the boundary (unlikely), within=TRUE. Explicitly, within = (delta<=0).

delta

the pseudo-distance δ discussed in Details

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

munsellinterpol documentation built on April 8, 2022, 9:07 a.m.