jnd2xyz: Convert JND distances into perceptually-corrected Cartesian...

View source: R/jnd2xyz.R

jnd2xyzR Documentation

Convert JND distances into perceptually-corrected Cartesian coordinates

Description

Converts a coldist() output into Cartesian coordinates that are perceptually-corrected (i.e. noise-weighted Euclidean distances)

Usage

jnd2xyz(
  coldistres,
  center = TRUE,
  rotate = TRUE,
  rotcenter = c("mean", "achro"),
  ref1 = "l",
  ref2 = "u",
  axis1,
  axis2
)

Arguments

coldistres

(required) the output from a coldist() call.

center

logical indicating if the data should be centered on its centroid (defaults to TRUE).

rotate

logical indicating if the data should be rotated (defaults to TRUE).

rotcenter

should the vectors for rotation be centered in the achromatic center ("achro") or the data centroid ("mean", the default)?

ref1

the cone to be used as a the first reference. May be NULL (for no first rotation in the 3-dimensional case) or must match name in the original data that was used for coldist(). Defaults to 'l'.

ref2

the cone to be used as a the second reference. May be NULL (for no first rotation in the 3-dimensional case) or must match name in the original data that was used for coldist(). Defaults to 'u'. (only used if data has 3 dimensions).

axis1

A vector of length number of cones minus 1 composed of 0's and 1's, with 1's representing the axes (x, y, z) to rotate around. Defaults to c(1, 1, 0) in 3 dimensions, such that the rotation aligns with the xy plane, and c(1, 0) in 2 dimentions, such that the rotation is centered on the x axis. Ignored if ref1 is NULL (in 3-dimensional case only). Ignored for dichromats.

axis2

A vector of length number of cones minus 1 composed of 0's and 1's, with 1's representing the axes (x, y, z) to rotate around. Defaults to c(0, 0, 1) in 3 dimensions, such that the rotation aligns with the z axis, and c(0, 1) in 2 dimentions, such that the rotation is centered on the y axis. Ignored if ref1 is NULL (in 3-dimensional case only). Ignored for dichromats.

Author(s)

Rafael Maia rm72@zips.uakron.edu

References

Pike, T.W. (2012). Preserving perceptual distances in chromaticity diagrams. Behavioral Ecology, 23, 723-728.

Maia, R., White, T. E., (2018) Comparing colors using visual models. Behavioral Ecology, ary017 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/beheco/ary017")}

Examples

# Load floral reflectance spectra
data(flowers)

# Estimate quantum catches visual phenotype of a Blue Tit
vis.flowers <- vismodel(flowers, visual = "bluetit")

# Estimate noise-weighted colour distances between all flowers
cd.flowers <- coldist(vis.flowers)

# Convert points to Cartesian coordinates in which Euclidean distances are
# noise-weighted.
jnd2xyz(cd.flowers)

rmaia/pavo documentation built on Feb. 11, 2025, 9:42 p.m.