X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FFunctors%2FInverse.hxx;h=4574cae2e712e94f77468d787e293b701d1fe3fb;hb=2b43395480bf95d0b399ded56aa272768bbc074a;hp=e2ad9f0092fc0645f0ec8ba679aaa57292a38a46;hpb=ea46079b5aef76c1782648ed23e70ea944649635;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/Functors/Inverse.hxx b/lib/fpa/Base/Functors/Inverse.hxx index e2ad9f0..4574cae 100644 --- a/lib/fpa/Base/Functors/Inverse.hxx +++ b/lib/fpa/Base/Functors/Inverse.hxx @@ -9,14 +9,18 @@ Evaluate( const TInput& x ) const { TInput sign = TInput( ( x < TInput( 0 ) )? -1: 1 ); TOutput y = TOutput( 1 ) / ( TOutput( 1 ) + TOutput( x * sign ) ); - return( y * TOutput( sign ) ); + if( sign < TInput( 0 ) ) + return( y * this->m_NegativeValue ); + else + return( y ); } // ------------------------------------------------------------------------- template< class _TInput, class _TOutput > fpa::Base::Functors::Inverse< _TInput, _TOutput >:: Inverse( ) - : Superclass( ) + : Superclass( ), + m_NegativeValue( _TOutput( -1 ) ) { }