From dc7b0175c06fcd6bd7a6d475a2592336953dad36 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Mon, 2 Nov 2015 18:48:50 -0500 Subject: [PATCH] Glitch hunted down --- lib/cpExtensions/Visualization/ImageBlender.cxx | 17 ++++++++--------- lib/cpExtensions/Visualization/ImageBlender.h | 8 ++++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/cpExtensions/Visualization/ImageBlender.cxx b/lib/cpExtensions/Visualization/ImageBlender.cxx index 6714d55..d5cbbd4 100644 --- a/lib/cpExtensions/Visualization/ImageBlender.cxx +++ b/lib/cpExtensions/Visualization/ImageBlender.cxx @@ -1,6 +1,5 @@ #include -#include #include #include @@ -135,8 +134,10 @@ GetColor( } else { - r = double( 1 ); - g = b = double( 0 ); + TColor c; + r = c.R; + g = c.G; + b = c.B; } // fi } @@ -390,12 +391,10 @@ _GenerateData( ); if( c > double( 0 ) ) { - double cr, cg, cb; - this->GetColor( i, cr, cg, cb ); - double n = std::sqrt( ( cr * cr ) + ( cg * cg ) + ( cb * cb ) ); - r *= cr * n; - g *= cg * n; - b *= cb * n; + TColor rgb = this->m_Colors[ i ]; + r *= rgb.R * rgb.N; + g *= rgb.G * rgb.N; + b *= rgb.B * rgb.N; a = _1; } // fi diff --git a/lib/cpExtensions/Visualization/ImageBlender.h b/lib/cpExtensions/Visualization/ImageBlender.h index 6ba1a43..f122822 100644 --- a/lib/cpExtensions/Visualization/ImageBlender.h +++ b/lib/cpExtensions/Visualization/ImageBlender.h @@ -3,7 +3,9 @@ #include +#include #include + #include namespace cpExtensions @@ -84,7 +86,7 @@ namespace cpExtensions protected: struct TColor { - double R, G, B; + double R, G, B, N; TColor( const double& r = double( 1 ), const double& g = double( 0 ), @@ -93,7 +95,9 @@ namespace cpExtensions : R( r ), G( g ), B( b ) - { } + { + this->N = std::sqrt( ( r * r ) + ( g * g ) + ( b * b ) ); + } }; mutable std::map< unsigned int, TColor > m_Colors; -- 2.47.1