X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FExtensions%2FDataStructures%2FQuadEdgeMesh.hxx;h=5fd57d63521657bcdf9527c0ea42e6166091ab94;hb=9015cf98c60cf4ab304a639990004ee783a8bec0;hp=cfcf232a00c4e690fd8300239fc3d68e67018a84;hpb=1740a32cbb99c4abd76ee0c0e5e45e0df3a8e800;p=cpPlugins.git diff --git a/lib/cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx b/lib/cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx index cfcf232..5fd57d6 100644 --- a/lib/cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx +++ b/lib/cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx @@ -478,9 +478,7 @@ typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >:: VectorType cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >:: _ComputePointNormal( const TPrimalEdge* e ) const { - static const TScalar zero = TScalar( 0 ); - - VectorType n( zero ); + VectorType n( TScalar( 0 ) ); if( Superclass::PointDimension == 3 ) { PointType p0 = this->GetPoint( e->GetOrigin( ) ); @@ -495,17 +493,18 @@ _ComputePointNormal( const TPrimalEdge* e ) const if( nIt == e->EndOnext( ) ) nIt = e->BeginOnext( ); - n += itk::CrossProduct( - this->GetPoint( ( *eIt )->GetDestination( ) ) - p0, - this->GetPoint( ( *nIt )->GetDestination( ) ) - p0 - ); + VectorType pe = this->GetPoint( ( *eIt )->GetDestination( ) ) - p0; + VectorType pn = this->GetPoint( ( *nIt )->GetDestination( ) ) - p0; + n[ 0 ] += ( pe[ 1 ] * pn[ 2 ] ) - ( pe[ 2 ] * pn[ 1 ] ); + n[ 1 ] += ( pe[ 2 ] * pn[ 0 ] ) - ( pe[ 0 ] * pn[ 2 ] ); + n[ 2 ] += ( pe[ 0 ] * pn[ 1 ] ) - ( pe[ 1 ] * pn[ 0 ] ); count++; } // fi } // rof TScalar nn = n.GetNorm( ); - if( nn > zero && count > 0 ) + if( nn > TScalar( 0 ) && count > 0 ) n /= nn * TScalar( count ); } // fi