]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/DataStructures/Simple3DCurve.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpExtensions / DataStructures / Simple3DCurve.cxx
index cda4399703e2a29f4b3636bce914b689b67360a9..1d1a92e000bcf114c7bd9873aa96b0063aa0f326 100644 (file)
@@ -50,6 +50,10 @@ GetFrame( unsigned int id ) const
     prev_no[ 1 ] = _TScalar( 1 );
     for( unsigned int i = 0; i < N; ++i )
     {
+      auto ntg = tg[ i ].GetNorm( );
+      if( double( ntg ) > double( 0 ) )
+        tg[ i ] /= ntg;
+
       _TScalar ct = prev_tg * tg[ i ];
       TVector a = itk::CrossProduct( prev_tg, tg[ i ] );
       _TScalar st = a.GetNorm( );
@@ -60,6 +64,10 @@ GetFrame( unsigned int id ) const
         ( prev_no * ct ) +
         ( itk::CrossProduct( a, prev_no ) * st ) +
         ( a * ( ( a * prev_no ) * ( _TScalar( 1 ) - ct ) ) );
+      auto nno = no[ i ].GetNorm( );
+      if( double( nno ) > double( 0 ) )
+        no[ i ] /= nno;
+
       bn[ i ] = itk::CrossProduct( tg[ i ], no[ i ] );
 
       prev_tg = tg[ i ];
@@ -80,7 +88,6 @@ GetFrame( unsigned int id ) const
       } // rof
       this->m_Frames.push_back( m );
 
-
     } // rof
 
     this->m_FramesUpdated = true;