]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/DataStructures/PolyLineParametricPath.hxx
PolyLine updated.
[cpPlugins.git] / lib / cpExtensions / DataStructures / PolyLineParametricPath.hxx
index 306ab79fe41fda72fa44de5d1f36043fc100e5c2..5e26816e47876a55d8501f8aad605a0b6381bdeb 100644 (file)
@@ -4,6 +4,18 @@
 #include <itkMath.h>
 #include <itkNumericTraits.h>
 
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
+AddVertex( const TContinuousIndex& vertex )
+{
+  this->Superclass::AddVertex( vertex );
+  this->m_Bezier->AddPoint(
+    this->GetPoint( this->GetSize( ) - 1 ).GetVectorFromOrigin( )
+    );
+  this->Modified( );
+}
+
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
 unsigned long cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
@@ -42,6 +54,18 @@ GetPoint( unsigned long i ) const
   return( pnt );
 }
 
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+typename cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
+TPoint cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
+GetSmoothPoint( double u ) const
+{
+  TPoint p;
+  p.Fill( 0 );
+  p += this->m_Bezier->Evaluate( u );
+  return( p );
+}
+
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
 void cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
@@ -129,6 +153,8 @@ cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
 PolyLineParametricPath( )
   : Superclass( )
 {
+  this->m_Bezier = TBezier::New( );
+
   this->m_Spacing.Fill( 1.0 );
   this->m_Origin.Fill( 0.0 );
   this->m_Direction.SetIdentity( );