From 04694569cff742ae64a810ba00faffffa92d8786 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 23 Jun 2010 14:23:32 +0000 Subject: [PATCH] corrected un-initialized variable in RGBtoHSV --- vcg/space/colorspace.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/vcg/space/colorspace.h b/vcg/space/colorspace.h index 3bdb59f9..ba827f13 100644 --- a/vcg/space/colorspace.h +++ b/vcg/space/colorspace.h @@ -1463,11 +1463,8 @@ public: static void RGBtoHSV(double R, double G, double B, double &H, double &S, double &V) { - double v = std::min(R, G); - double v_min = std::min(v, B); // Min value of RGB - - double v2 = std::max(R, G); - double v_max = std::max(v2, B); // Max value of RGB + double v_min = std::min(std::min(R, G), B); // Min value of RGB + double v_max = std::max(std::max(R, G), B); // Max value of RGB double delta = v_max - v_min; //Delta RGB value @@ -1492,12 +1489,10 @@ public: H = (1.0 / 3.0) + deltaR - deltaB; else if (B == v_max) H = (2.0 / 3.0) + deltaG - deltaR; + else H = 0; // this final branch should never happen... - if ( H < 0 ) - H += 1.0; - - if ( H > 1 ) - H -= 1.0; + if ( H < 0 ) H += 1.0; + if ( H > 1 ) H -= 1.0; } }