inGamut function

bool inGamut(
  1. LinRgb c, [
  2. double eps = 1e-9
])

Whether c lies in the sRGB gamut, with tolerance eps.

Implementation

bool inGamut(LinRgb c, [double eps = 1e-9]) =>
    c.$1 >= -eps &&
    c.$1 <= 1 + eps &&
    c.$2 >= -eps &&
    c.$2 <= 1 + eps &&
    c.$3 >= -eps &&
    c.$3 <= 1 + eps;