View source: R/colorSpec.optimal.R
inside | R Documentation |
Test points for being inside the surface of optimal colors,
which is the boundary of the object color solid.
It is essentially a wrapper around
zonohedra::inside()
.
## S3 method for class 'colorSpec'
insideOptimalColors( x, p )
x |
a colorSpec object - with 1, 2, or 3 spectra |
p |
an NxM numeric matrix, where M is the number of spectra.
The points to be tested are in the rows.
|
insideOptimalColors()
returns a data.frame
with N rows and these columns:
p |
the given point |
distance |
the signed distance from the point to the boundary surface of optimal colors.
When |
inside |
whether the point is inside the zonotope. |
If the row names of p
are unique,
they are copied to the row names of the output.
In case of error, the function returns NULL
.
zonohedra::inside()
wave = seq(400,800,by=4)
D50.eye = product( D50.5nm, 'varmat', xyz1931.1nm, wave=wave )
white = colSums( 4 * as.matrix(D50.eye) )
insideOptimalColors( D50.eye, c(30,50,70, 0,0,0, white, white+1 ) )
## p.1 p.2 p.3 inside distance
## 1 30.00000 50.00000 70.00000 TRUE -7.528005
## 2 0.00000 0.00000 0.00000 TRUE 0.000000
## 3 101.24793 105.04021 86.52988 TRUE 0.000000
## 4 102.24793 106.04021 87.52988 FALSE 1.259912
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.