MCPcopy Create free account
hub / github.com/FastLED/FastLED / calculateRGBDeviation

Function calculateRGBDeviation

tests/fl/hsv2rgb_accuracy.cpp:66–71  ·  view source on GitHub ↗

Calculate euclidean distance between two RGB colors

Source from the content-addressed store, hash-verified

64
65// Calculate euclidean distance between two RGB colors
66static float calculateRGBDeviation(const CRGB& original, const CRGB& converted) {
67 float dr = float(original.r) - float(converted.r);
68 float dg = float(original.g) - float(converted.g);
69 float db = float(original.b) - float(converted.b);
70 return fl::sqrtf(dr*dr + dg*dg + db*db);
71}
72
73// Test a specific conversion function with RGB -> HSV -> RGB round trip
74template<typename ConversionFunc>

Callers 1

testConversionFunctionFunction · 0.85

Calls 1

sqrtfFunction · 0.85

Tested by

no test coverage detected