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( ) );
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