/**
* Convert hue values to a color component (ie one of r, g, b)
* @param {Number} p
* @param {Number} q
* @param {Number} t
* @return {Number} color component
* @alias module:modeling/colors.hueToColorComponent
*/
const hueToColorComponent = (p, q, t) => {
if (t < 0) t += 1
if (t > 1) t -= 1
if (t < 1 / 6) return p + (q - p) * 6 * t
if (t < 1 / 2) return q
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6
return p
}
module.exports = hueToColorComponent