]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/DataStructures/Simple3DCurve.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / DataStructures / Simple3DCurve.h
diff --git a/lib/cpExtensions/DataStructures/Simple3DCurve.h b/lib/cpExtensions/DataStructures/Simple3DCurve.h
new file mode 100644 (file)
index 0000000..0641d43
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef __cpExtensions__DataStructures__Simple3DCurve__h__
+#define __cpExtensions__DataStructures__Simple3DCurve__h__
+
+#include <cpExtensions/Config.h>
+#include <itkDataObject.h>
+#include <itkObjectFactory.h>
+#include <itkMatrix.h>
+#include <itkPoint.h>
+
+namespace cpExtensions
+{
+  namespace DataStructures
+  {
+    /**
+     */
+    template< class _TScalar >
+    class cpExtensions_EXPORT Simple3DCurve
+      : public itk::DataObject
+    {
+    public:
+      typedef Simple3DCurve                   Self;
+      typedef itk::DataObject                 Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef _TScalar TScalar;
+      typedef itk::Matrix< TScalar, 3, 3 > TMatrix;
+      typedef itk::Point< TScalar, 3 >     TPoint;
+      typedef typename TPoint::VectorType  TVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( Simple3DCurve, itk::DataObject );
+
+    public:
+      template< class _TVector >
+      inline void AddPoint( const _TVector& v )
+        {
+          TPoint p;
+          p[ 0 ] = v[ 0 ];
+          p[ 1 ] = v[ 1 ];
+          p[ 2 ] = v[ 2 ];
+          this->m_Points.push_back( p );
+          this->Modified( );
+        }
+
+      virtual void Modified( ) const cpExtensions_OVERRIDE;
+      void Clear( );
+      unsigned long GetNumberOfPoints( ) const;
+      const TMatrix& GetFrame( unsigned int id ) const;
+      const TPoint& GetPoint( unsigned int id ) const;
+      TVector GetVector( unsigned int id ) const;
+
+    protected:
+      Simple3DCurve( );
+      virtual ~Simple3DCurve( );
+
+    private:
+      // Purposely not implemented
+      Simple3DCurve( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      std::vector< TPoint > m_Points;
+      mutable std::vector< TMatrix > m_Frames;
+      mutable bool m_FramesUpdated;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __cpExtensions__DataStructures__Simple3DCurve__h__
+
+// eof - $RCSfile$