]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx
First modifications to make this work on MS-Windows
[cpPlugins.git] / lib / cpPlugins / Extensions / DataStructures / QuadEdgeMesh.hxx
index cfcf232a00c4e690fd8300239fc3d68e67018a84..5fd57d63521657bcdf9527c0ea42e6166091ab94 100644 (file)
@@ -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