pth_to_cartesian: Convert between Cartesian and polar coordinates

View source: R/mat.R

pth_to_cartesianR Documentation

Convert between Cartesian and polar coordinates

Description

Convert between Cartesian and polar coordinates

Usage

pth_to_cartesian(mat_polar, chroma_min = 1e-04)

pth_to_polar(mat_cartesian)

Arguments

mat_polar

matrix with columns for luminance, chroma, hue.

chroma_min

numeric "trick" used to preserve the hue at zero chroma, using a value small enough not to affect color-perception.

mat_cartesian

matrix with columns for luminance, blue-yellow, green-red.

Value

matrix with same dimension as the input matrix.

Examples

  polar <- matrix(c(50, 0, 45), ncol = 3)
  cart <- pth_to_cartesian(polar)
  polar_new <- pth_to_polar(cart)
  # notice the chroma value has an artificial floor
  # using an imperceptible (color) difference
  print(polar)
  print(cart)
  print(polar_new)

ijlyttle/colorpath documentation built on Sept. 13, 2022, 7:44 p.m.