colour_space {colourvision}R Documentation

N-dimensional colour spaces

Description

Generates a colour space based on any number of photoreceptor types and finds a colour locus for a given photoreceptor output.

Usage

colour_space(n, type="length", length=NA, edge=NA,
          q=rep(1,n), recep.noise=FALSE, e=NA)

Arguments

n

Number of photoreceptor types. Function accepts any number of photoreceptor types >=2. For instance, trichromatic: n=3; tetrachromatic: n=4, etc.

type

Whether the colour space should be built with a fixed vector length (type="length"), or a fixed distance between vertices (type="edge"; e.g. Pike 2012 and Renoult et al. 2015).

length

Vector length used to construct the colour space. Used when type="length". Typically length=1.

edge

Edge length used to construct the colour space. Used when type="edge".

q

Photoreceptor output values

recep.noise

Whether receptor noise should be used to calculate colour locus coordinates.

e

Vector representing photoreceptor noises. Used when recep.noise=TRUE

Details

This function is used internally in colour vision models.

Value

A list with the following dimensions:

coordinates

Colour locus of photoreceptor output values q in the colour space

vector_matrix

Matrix of column vectors, each representing one photoreceptor type

Author(s)

Felipe M. Gawryszewski f.gawry@gmail.com

References

Pike, T.W. 2012. Generalised chromaticity diagrams for animals with n-chromatic colour vision. Journal of Insect Behavior 255: 277-286.

Renoult, J. P., A. Kelber, and H. M. Schaefer. 2015. Colour spaces in ecology and evolutionary biology. Biol Rev Camb Philos Soc, doi: 10.1111/brv.12230.

See Also

Q, Qr, CTTKmodel, EMmodel, RNLmodel, GENmodel

Examples

#A trichromatic colour space based on Endler and Mielke (2005) 
tri<-colour_space(n=3, length=0.75, q=c(0.5,0.2,0.3))

#showing:
#(1) Limits of the colour space (triangle)
plot(0, ylim=c(-1,1), xlim=c(-1,1), asp=1, ylab="X2", xlab="X1", type="n")
polygon(x=tri$vector_matrix[1,], y=tri$vector_matrix[2,], lty=2)

#(2) Vectors (length=0.75) used to build the colour space (arrows)
arrows(x0=0,y0=0, x1=tri$vector_matrix[1,1], y1=tri$vector_matrix[2,1], col="red")
arrows(x0=0,y0=0, x1=tri$vector_matrix[1,2], y1=tri$vector_matrix[2,2], col="red")
arrows(x0=0,y0=0, x1=tri$vector_matrix[1,3], y1=tri$vector_matrix[2,3], col="red")

#(3) Colour loci of given photoreceptor outputs
points(x=tri$coordinates[[1]], y=tri$coordinates[[2]], pch=21, col="blue", bg="blue")

[Package colourvision version 2.0.4 Index]