#include <iostream>
#include <string>
-#include <cpPlugins/Extensions/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/MeshReader.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
+#include <cpPlugins/Extensions/IO/MeshReader.h>
// -------------------------------------------------------------------------
const unsigned int Dimension = 3;
typedef float TScalar;
-typedef cpPlugins::Extensions::QuadEdgeMesh< TScalar, Dimension > TMesh;
+typedef cpPlugins::Extensions::
+DataStructures::QuadEdgeMesh< TScalar, Dimension >
+TMesh;
// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
} // fi
- typedef cpPlugins::Extensions::MeshReader< TMesh > TReader;
+ typedef cpPlugins::Extensions::IO::MeshReader< TMesh > TReader;
TReader::Pointer reader = TReader::New( );
reader->SetFileName( argv[ 1 ] );
reader->Update( );
#include <iostream>
#include <string>
-#include <cpPlugins/Extensions/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/MeshReader.h>
-#include <cpPlugins/Extensions/OpenGLMeshMapper.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
+#include <cpPlugins/Extensions/IO/MeshReader.h>
+#include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
#include <vtkActor.h>
#include <vtkCallbackCommand.h>
// -------------------------------------------------------------------------
const unsigned int Dimension = 3;
typedef float TScalar;
-typedef cpPlugins::Extensions::QuadEdgeMesh< TScalar, Dimension > TMesh;
-typedef cpPlugins::Extensions::OpenGLMeshMapper< TMesh > TMeshMapper;
+using namespace cpPlugins::Extensions;
+typedef DataStructures::QuadEdgeMesh< TScalar, Dimension > TMesh;
+typedef Visualization::OpenGLMeshMapper< TMesh > TMeshMapper;
// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
} // fi
- typedef cpPlugins::Extensions::MeshReader< TMesh > TReader;
+ typedef IO::MeshReader< TMesh > TReader;
TReader::Pointer reader = TReader::New( );
reader->SetFileName( argv[ 1 ] );
reader->Update( );
FILE(GLOB LIB_SOURCES_CPP "*.cpp")
FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+FILE(GLOB LIB_DataStructures_HEADERS_H "*.h")
+FILE(GLOB LIB_DataStructures_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_DataStructures_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_DataStructures_SOURCES_C "*.c")
+FILE(GLOB LIB_DataStructures_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_DataStructures_SOURCES_CXX "*.cxx")
+
+FILE(GLOB LIB_IO_HEADERS_H "*.h")
+FILE(GLOB LIB_IO_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_IO_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_IO_SOURCES_C "*.c")
+FILE(GLOB LIB_IO_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_IO_SOURCES_CXX "*.cxx")
+
+FILE(GLOB LIB_Visualization_HEADERS_H "*.h")
+FILE(GLOB LIB_Visualization_HEADERS_HPP "*.hpp")
+FILE(GLOB LIB_Visualization_HEADERS_HXX "*.hxx")
+FILE(GLOB LIB_Visualization_SOURCES_C "*.c")
+FILE(GLOB LIB_Visualization_SOURCES_CPP "*.cpp")
+FILE(GLOB LIB_Visualization_SOURCES_CXX "*.cxx")
+
## =====================
## = Compilation rules =
## =====================
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGE__H__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGE__H__
+
+#include <itkLightObject.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeIterators.h>
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace DataStructures
+ {
+ /**
+ */
+ template< typename P, typename D, bool IsPrimal = true >
+ class QuadEdge
+ : public itk::LightObject
+ {
+ public:
+ typedef QuadEdge Self;
+ typedef itk::LightObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ /// Vertices and faces types
+ typedef P TPrimalGeometry;
+ typedef D TDualGeometry;
+
+ /**
+ * Dual type, basically the same type with swapped template
+ * parameters.
+ */
+ typedef QuadEdge< D, P, !IsPrimal > TDual;
+ typedef Self TPrimal;
+ typedef typename TDual::Pointer PtrDual;
+ friend TDual;
+
+ /// Iterators
+ typedef QuadEdgeIterator< TPrimal > Iterator;
+ typedef QuadEdgeConstIterator< TPrimal > ConstIterator;
+ typedef QuadEdgePointIterator< TPrimal > PointIterator;
+ typedef QuadEdgePointConstIterator< TPrimal > PointConstIterator;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( QuadEdge, itkLightObject );
+
+ cpPluginsExtensionsQEAllIteratorsMacro( Onext );
+ cpPluginsExtensionsQEAllIteratorsMacro( Lnext );
+ cpPluginsExtensionsQEAllIteratorsMacro( Rnext );
+ cpPluginsExtensionsQEAllIteratorsMacro( Dnext );
+ cpPluginsExtensionsQEAllIteratorsMacro( Oprev );
+ cpPluginsExtensionsQEAllIteratorsMacro( Lprev );
+ cpPluginsExtensionsQEAllIteratorsMacro( Rprev );
+ cpPluginsExtensionsQEAllIteratorsMacro( Dprev );
+
+ public:
+ void CreateRings( );
+
+ /// First order access methods
+ inline TPrimal* GetOnext( )
+ { return( this->m_Onext ); }
+ inline TDual* GetRot( )
+ { return( this->m_Rot ); }
+ inline const TPrimal* GetOnext( ) const
+ { return( this->m_Onext ); }
+ inline const TDual* GetRot( ) const
+ { return( this->m_Rot ); }
+
+ /// First order configuration methods
+ inline void SetOnext( TPrimal* e )
+ { this->m_Onext = e; }
+ inline void SetRot( TDual* e )
+ { this->m_Rot = e; }
+
+ /// Second order accessors: around base rings
+ inline TPrimal* GetSym( )
+ { return( this->m_Rot->m_Rot ); }
+ inline TDual* GetInvRot( )
+ { return( this->m_Rot->m_Rot->m_Rot ); }
+
+ /// Second order accessors: neighboring topology
+ inline TPrimal* GetLnext( )
+ { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
+ inline TPrimal* GetRnext( )
+ { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
+ inline TPrimal* GetDnext( )
+ { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
+ inline TPrimal* GetOprev( )
+ { return( this->m_Rot->m_Onext->m_Rot ); }
+ inline TPrimal* GetLprev( )
+ { return( this->m_Onext->m_Rot->m_Rot ); }
+ inline TPrimal* GetRprev( )
+ { return( this->m_Rot->m_Rot->m_Onext ); }
+ inline TPrimal* GetDprev( )
+ {
+ return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot );
+ }
+
+ /// Second order accessors: around base rings (const versions)
+ inline const TPrimal* GetSym( ) const
+ { return( this->m_Rot->m_Rot ); }
+ inline const TDual* GetInvRot( ) const
+ { return( this->m_Rot->m_Rot->m_Rot ); }
+
+ /// Second order accessors: neighboring topology (const versions)
+ inline const TPrimal* GetLnext( ) const
+ { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
+ inline const TPrimal* GetRnext( ) const
+ { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
+ inline const TPrimal* GetDnext( ) const
+ { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
+ inline const TPrimal* GetOprev( ) const
+ { return( this->m_Rot->m_Onext->m_Rot ); }
+ inline const TPrimal* GetLprev( ) const
+ { return( this->m_Onext->m_Rot->m_Rot ); }
+ inline const TPrimal* GetRprev( ) const
+ { return( this->m_Rot->m_Rot->m_Onext ); }
+ inline const TPrimal* GetDprev( ) const
+ {
+ return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot );
+ }
+
+ /// Get geometry methods
+ inline P& GetOrigin( )
+ { return ( this->m_Origin ); }
+ inline P& GetDestination( )
+ { return ( this->m_Rot->m_Rot->m_Origin ); }
+ inline D& GetRight( )
+ { return ( this->m_Rot->m_Origin ); }
+ inline D& GetLeft( )
+ { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
+
+ /// Get geometry methods (const versions)
+ inline const P& GetOrigin( ) const
+ { return ( this->m_Origin ); }
+ inline const P& GetDestination( ) const
+ { return ( this->m_Rot->m_Rot->m_Origin ); }
+ inline const D& GetRight( ) const
+ { return ( this->m_Rot->m_Origin ); }
+ inline const D& GetLeft( ) const
+ { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
+
+ /// Set geometry methods
+ inline void SetOrigin( const P& v )
+ { this->m_Origin = v; }
+ inline void SetDestination( const P& v )
+ { this->m_Rot->m_Rot->m_Origin = v; }
+ inline void SetRight( const D& v )
+ { this->m_Rot->m_Origin = v; }
+ inline void SetLeft( const D& v )
+ { this->m_Rot->m_Rot->m_Rot->m_Origin = v; }
+ inline void UnsetOrigin( )
+ { this->m_Origin = TPrimal::NoGeometry; }
+ inline void UnsetDestination( )
+ { this->m_Rot->m_Rot->m_Origin = TPrimal::NoGeometry; }
+ inline void UnsetRight( )
+ { this->m_Rot->m_Origin = TDual::NoGeometry; }
+ inline void UnsetLeft( )
+ { this->m_Rot->m_Rot->m_Rot->m_Origin = TDual::NoGeometry; }
+
+ /**
+ * Set the Left( ) of all the edges in the Lnext( ) ring of "this"
+ * with the same given geometrical information.
+ * @param faceGeom Looks at most maxSize edges in the Lnext( ) ring.
+ * @return Returns true on success. False otherwise.
+ */
+ void SetLnextRingGeometry( const D& v );
+ void UnsetLnextRingGeometry( );
+
+ /// Topological queries
+ inline bool IsIsolated( ) const
+ { return( this == this->m_Onext ); }
+ bool IsEdgeInOnextRing( const TPrimal* e ) const;
+ bool IsEdgeInLnextRing( const TPrimal* e ) const;
+ unsigned int GetOnextRingSize( ) const;
+ unsigned int GetLnextRingSize( ) const;
+
+ /**
+ * @return Returns true when "this" has no faces set on both sides.
+ * Return false otherwise.
+ */
+ inline bool IsWire( )
+ { return( !( this->IsLeftSet( ) ) && !( this->IsRightSet( ) ) ); }
+
+ /**
+ * @return Returns true when "this" is on the boundary i.e.
+ * one and only one of the faces is set. Return false
+ * otherwise.
+ */
+ inline bool IsAtBorder( ) const;
+
+ /**
+ * @return Returns true when "this" has faces set on both sides.
+ * Return false otherwise.
+ */
+ inline bool IsInternal( ) const
+ { return ( this->IsLeftSet( ) && this->IsRightSet( ) ); }
+
+ /// Geometrical queries
+ inline bool IsOriginSet( ) const
+ { return ( this->m_Origin != Self::NoGeometry ); }
+ inline bool IsDestinationSet( ) const
+ { return ( this->m_Rot->m_Rot->IsOriginSet( ) ); }
+ inline bool IsRightSet( ) const
+ { return ( this->m_Rot->IsOriginSet( ) ); }
+ inline bool IsLeftSet( ) const
+ { return ( this->m_Rot->m_Rot->m_Rot->IsOriginSet( ) ); }
+
+ /**
+ * \brief Check wether edge's Origin is internal to the mesh (as
+ * opposed to being on the boundary) by looking if all the edges
+ * in the Onext() ring have a face set on both their Left() and
+ * Right() side.
+ */
+ bool IsOriginInternal( ) const;
+
+ /**
+ * Definition: an edge is said to be a boundary edge when it is
+ * adjacent to i.e. when at least one of the faces edge->GetLeft() or
+ * edge->GetRight() is unset. Definition: an point is said to be a
+ * boundary point when at least one of the edges of it's Onext() ring
+ * is a boundary edge.
+ *
+ * Assume "this" edge belongs to a triangulation (i.e. it belongs to a
+ * QEMesh which represents a 2-manifold) which possesses a boundary.
+ * Assume "this" edge instance is a boundary edge. Let us denote by P
+ * the point which is the origin of "this" edge i.e. P is
+ * this->Origin(). By definition P is a boundary point. Then AT
+ * LEAST two [see the note below] edges of the Onext() ring of P
+ * [which all have the point P as Origin()] are themselves boundary
+ * edges. And among those boundary edges AT LEAST one has it's Left()
+ * face unset. By iterating over the Onext() ring (which defines a
+ * local ordering on edges) this method searches for the first edge
+ * whose Left() face is unset AND which is encountered AFTER edgeTest.
+ *
+ * @param edgeTest When present, this edge will be considered as
+ * the entry edge in the Onext() ring. When absent it shall
+ * be defaulted to "this" edge. (see the warning below).
+ * @return When "this" edge is a boundary edge, return the first
+ * edge in "this" Onext() ring whose Left() face is unset
+ * AND located after edgeTest.
+ * When "this" edge is NOT a boundary edge the 0 is
+ * returned.
+ * @warning When the Mesh possessing "this" edge is a 2-manifold
+ * then result of this method is unique in the sense that
+ * it is independent from the edgeTest parameter.
+ * But when the Mesh is not 2-manifold (this state can
+ * happen at intermediary stages of the building process,
+ * or during "surgical" operations on the Mesh, and
+ * even though the Mesh represents a triangulation)
+ * the result of this method is not unique in the sense
+ * that the result depends on the edgeTest parameter.
+ * Let us illusatre this dependence by considering a
+ * Mesh (which is a triangulation) which is not a 2-manifold.
+ * Assume the point P (the origin of "this" edge i.e.
+ * P = this->Originv()) is TWICE on the border i.e. it
+ * is adjacent twice to noface. We can consider the situation
+ * of the following diagram, which depicts some Onext()
+ * ring around point P:
+ *
+ * \ / //
+ * \ * / //
+ * i3 b2 counter-clockwise //
+ * * \ / NO FACE Onext() order. //
+ * \ / //
+ * ----b4-----P----b1------ //
+ * /|\ //
+ * NO FACE / | \ //
+ * / | \ * <------ a * indicates the //
+ * / | \ the presence of a face //
+ * / | \ //
+ * b5 i6 i7 //
+ * / * | * \ //
+ * / | \ //
+ *
+ * On this example, and if we assume the Onext() oder is
+ * represented counter-clockwise, the edges are ordered as
+ * follows:
+ * b1, b2, i3, b4, b5, i6, i7
+ * (when arbitrarily starting at edge b1).
+ * We have four Boundary edges labeled b1, b2, b4, b5 and
+ * we have three internal edges (i.e. non boundary edges)
+ * labeled i3, i6 and i7.
+ * Depending on edgeTest, the result of this method
+ * will NOT return the same edge:
+ * - when edgeTest == b5 (or i6 or i7 or b1) then the edge
+ * b1 will be returned,
+ * - when edgeTest == b2 (or i3 or b4) then the edge
+ * b4 will be returned,
+ * Eventually, when edgeTest is absent, the result shall
+ * depend on the position of "this" in the Onext() ring().
+ *
+ */
+ TPrimal* GetNextBorderEdgeWithUnsetLeft( TPrimal* edge = NULL ) const;
+
+ /**
+ * Assume "this->Originv()" is a boundary point P that is thrice
+ * adjacent to noface and consider the given situation is the one
+ * depicted by the following diagram where:
+ * - P is "this->Originv()" instance,
+ * - the * (star) indicates the presence of a face,
+ * - b1, b2, b3, b4, b5, b6 denote boundary edges,
+ * - p denotes some generic point,
+ * - A and B denote some specific points we want to discuss,
+ * - the Onext() ring order is represented counter-clockwise
+ * [which is coherent with the definition of edge->GetRigth()]
+ * i.e. the ordering of the edges is:
+ * b1, b2, b3, b4, b5, b6, b1...
+ *
+ * p N p
+ * / \ O / \ //
+ * / \ / \ //
+ * / \ F / \ counter-clockwise //
+ * / b3 A b2 \ Onext() ring order //
+ * / \ C / \ //
+ * / * \ E / * \ //
+ * / \ / \ //
+ * A------b4------P------b1-------B //
+ * / \ //
+ * / \ //
+ * NO FACE / \ NO FACE //
+ * / \ //
+ * b5 b6 //
+ * / * \ //
+ * / \ //
+ * p---------------p //
+ *
+ * At P this Mesh doesn't represent a 2-manifold (since we are thrice
+ * on the boundary). Nevertheless such a situation could arise in
+ * intermediary stages (e.g. when building the Mesh, or during
+ * surgical changes on the Mesh).
+ * Now, assume we are asked to build the triangle [P, A, B]. Note
+ * that this request is not absurd since the current situation at
+ * P isn't the one of a 2-manifold: hence when building the current
+ * Onext() ring of P, we had not enough information to decide
+ * wheter b4.Onext() should be b5 or b1. It is ONLY when we are
+ * required to build the triangle [P, A, B] that we have the
+ * additional information that b4.Onext() is indeed b1.
+ * When we are required to build triangle [P, A, B], we hence
+ * need to change the Onext() ring order at P, i.e. we need to deal
+ * with the triangle [P, b5, b6] which currently prevents
+ * b4.Onext() to be b1. In other terms, when considering the
+ * additional information that b4.Onext() is b1, and before
+ * building the triangle [P, A, B], we need to reorder
+ * the Onext() ring of P from it's current state
+ * b1, b2, b3, b4, b5, b6, b1...
+ * to an order coherent with the [P, A, B] request, i.e.
+ * b1, b2, b5, b6, b3, b4, b1...
+ *
+ * In order to establish the "proper" Onext() ring at P we use
+ * two Splice operations. The algorithm goes:
+ * - first disconnect the piece of the surface containing the edge
+ * [PB] (it would be the same process if we chose [PA]) from
+ * the Onext() ring at P.
+ * - second, re-integrate the disconnected piece at the desired
+ * location i.e. side by side with [PA] (respectively [PB] if
+ * we chose [PA] at first stage).
+ * By "piece of surface containing the edge [PB]" we mean [all]
+ * the triangle[s] starting at [PB] in the Onext() order and
+ * having a left face set.
+ *
+ * We can illustrate this process on bit more general diagram than
+ * the last case (where the "piece of surface containing the edge
+ * [PB]" is constituted by two triangles) and when using
+ * the arguments of this method (i.e. [PA] = this and [PB] = second).
+ * The initial stage is the following (we note first=this=[PA] and
+ * second=[PB]) where the Onext() ring order is:
+ * first, b2, b3, second, b5, bsplice, b7, first...
+ *
+ * p N A //
+ * / \ O / \ //
+ * / \ / \ //
+ * / \ F / \ counter-clockwise //
+ * / b2 A first \ Onext() ring order //
+ * / \ C / \ //
+ * / * \ E / * \ //
+ * / \ / \ //
+ * p-------b3------P------b7-------p //
+ * /|\ //
+ * / | \ //
+ * NO FACE / | \ NO FACE //
+ * / | \ //
+ * second b5 bsplice //
+ * / * | * \ //
+ * / | \ //
+ * B-------p-------p //
+ *
+ * The first stage, implemented as
+ * second->Oprev()->Splice( bsplice ),
+ * yields the following diagram:
+ *
+ * p N A //
+ * / \ O / \ //
+ * / \ F / \ //
+ * / \ A / \ counter-clockwise //
+ * / b2 C first \ Onext() ring order //
+ * / \ E / \ //
+ * / * \ / * \ //
+ * / \ / \ //
+ * p-------b3------P------b7-------p //
+ * //
+ * NO FACE //
+ * //
+ * /|\ //
+ * / | \ //
+ * / | \ //
+ * / | \ //
+ * second b5 bsplice //
+ * / * | * \ //
+ * / | \ //
+ * B-------p-------p //
+ *
+ * and the second stage, implemented as
+ * first->Splice( bsplice ),
+ * yields the following diagram:
+ *
+ * A //
+ * B__ NO FACE / \ //
+ * | \__ / \ //
+ * | \__ / \ counter- //
+ * | second first \ clockwise for all //
+ * | \__ / \ //
+ * | * \__ / * \ //
+ * | \ / \ //
+ * p-------b5---------P------b7-------p //
+ * | __/|\ //
+ * | * __/ | \ //
+ * | / | \ NO FACE //
+ * | bsplice | \ //
+ * | __/ b2 b3 //
+ * p__/ | * \ //
+ * NO FACE | \ //
+ * p-------p //
+ *
+ */
+ inline static bool ReorderOnextRing( TPrimal* first, TPrimal* second );
+
+ /**
+ * \brief Basic quad-edge topological method.
+ *
+ * This method describes all possible topological operations on an
+ * edge since it is its own inverse. It works in two ways:
+ *
+ * 1. If this->m_Org != b->m_Org, it slice a face in two.
+ * 2. If this->m_Org == b->m_Org, it unifies two faces.
+ */
+ inline static void Splice( TPrimal* a, TPrimal* b );
+
+ protected:
+ QuadEdge( );
+ virtual ~QuadEdge( );
+
+ public:
+ static const TPrimalGeometry NoGeometry;
+
+ protected:
+ Pointer m_Onext; /**< Onext ring */
+ PtrDual m_Rot; /**< Rot ring */
+ TPrimalGeometry m_Origin; /**< Geometry attached to edge's origin */
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/DataStructures/QuadEdge.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGE__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGE__HXX__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGE__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGE__HXX__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGE__HXX__
#include <limits>
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-const typename cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
-TPrimalGeometry cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+const typename cpPlugins::Extensions::DataStructures::
+QuadEdge< P, D, IsPrimal >::TPrimalGeometry
+cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
NoGeometry = std::numeric_limits< P >::max( );
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-void cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+void cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
CreateRings( )
{
TPrimal* e = this;
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-void cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+void cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
SetLnextRingGeometry( const D& v )
{
for( Iterator i = this->BeginLnext( ); i != this->EndLnext( ); ++i )
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-void cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+void cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
UnsetLnextRingGeometry( )
{
this->SetLnextRingGeometry( TDual::NoGeometry );
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-bool cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+bool cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
IsEdgeInOnextRing( const TPrimal* e ) const
{
bool found = false;
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-bool cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+bool cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
IsEdgeInLnextRing( const TPrimal* e ) const
{
bool found = false;
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-unsigned int cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+unsigned int
+cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
GetOnextRingSize( ) const
{
unsigned int count = 0;
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-unsigned int cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+unsigned int
+cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
GetLnextRingSize( ) const
{
unsigned int count = 0;
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-bool cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+bool cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
IsAtBorder( ) const
{
return(
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-bool cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+bool cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
IsOriginInternal( ) const
{
bool internal = true;
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-typename cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
-TPrimal* cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+typename cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
+TPrimal* cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
GetNextBorderEdgeWithUnsetLeft( TPrimal* edge ) const
{
// Be sure the Onext ring isn't already full
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-bool cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+bool cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
ReorderOnextRing( TPrimal* first, TPrimal* second )
{
// Making sure point adjacency is correct:
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-void cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+void cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
Splice( TPrimal* a, TPrimal* b )
{
// Don't waste time splicing the same edge (or non-existent)
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
QuadEdge( )
: m_Origin( Self::NoGeometry )
{
// -------------------------------------------------------------------------
template< typename P, typename D, bool IsPrimal >
-cpPlugins::Extensions::QuadEdge< P, D, IsPrimal >::
+cpPlugins::Extensions::DataStructures::QuadEdge< P, D, IsPrimal >::
~QuadEdge( )
{
}
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGE__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGE__HXX__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGECELL__H__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGECELL__H__
+
+#include <vector>
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace DataStructures
+ {
+ /**
+ */
+ template< class I, class E >
+ class QuadEdgeCell
+ : public I
+ {
+ public:
+ // Base types
+ typedef QuadEdgeCell Self;
+ typedef I Superclass;
+ typedef itk::AutoPointer< Self > SelfAutoPointer;
+ typedef itk::AutoPointer< const Self > ConstSelfAutoPointer;
+ typedef Self* RawPointer;
+ typedef const Self* ConstRawPointer;
+
+ // QuadEdge objects
+ typedef E TPrimalEdge;
+ typedef typename E::TDual TDualEdge;
+
+ // Inherited types
+ typedef typename I::PixelType PixelType;
+ typedef typename I::CellType CellType;
+ typedef typename I::CellAutoPointer CellAutoPointer;
+ typedef typename I::CellConstAutoPointer CellConstAutoPointer;
+ typedef typename I::CellRawPointer CellRawPointer;
+ typedef typename I::CellConstRawPointer CellConstRawPointer;
+ typedef typename I::CellTraits CellTraits;
+ typedef typename I::CoordRepType CoordRepType;
+ typedef typename I::InterpolationWeightType InterpolationWeightType;
+ typedef typename I::PointIdentifier PointIdentifier;
+ typedef typename I::PointIdIterator PointIdIterator;
+ typedef typename I::PointIdConstIterator PointIdConstIterator;
+ typedef typename I::CellIdentifier CellIdentifier;
+ typedef typename I::CellFeatureIdentifier CellFeatureIdentifier;
+ typedef typename I::CellFeatureIdentifier CellFeatureCount;
+ typedef typename I::PointType PointType;
+ typedef typename I::VectorType VectorType;
+ typedef typename I::PointsContainer PointsContainer;
+ typedef typename I::UsingCellsContainer UsingCellsContainer;
+ typedef typename I::CellGeometry CellGeometry;
+ typedef typename I::ParametricCoordArrayType ParametricCoordArrayType;
+ typedef typename I::ShapeFunctionsArrayType ShapeFunctionsArrayType;
+
+ itkStaticConstMacro( PointDimension, unsigned int, I::PointDimension );
+ itkStaticConstMacro( CellDimension, unsigned int, 2 );
+
+ public:
+ itkTypeMacro( QuadEdgeCell, I );
+
+ public:
+ QuadEdgeCell( );
+ QuadEdgeCell( E* entry );
+ virtual ~QuadEdgeCell( );
+
+ /// Implement the standard CellInterface.
+ virtual CellGeometry GetType( ) const;
+ virtual void MakeCopy( CellAutoPointer& other ) const;
+ virtual unsigned int GetDimension( ) const;
+ virtual unsigned int GetNumberOfPoints( ) const;
+ virtual CellFeatureCount GetNumberOfBoundaryFeatures(
+ int dimension
+ ) const;
+ virtual bool GetBoundaryFeature(
+ int dimension, CellFeatureIdentifier fId, CellAutoPointer& ptr
+ );
+ virtual void SetPointIds( PointIdConstIterator first );
+ virtual void SetPointIds(
+ PointIdConstIterator first, PointIdConstIterator last
+ );
+ virtual void AddPointId( PointIdentifier pId );
+ virtual void RemovePointId( PointIdentifier pId );
+ virtual void SetPointIds(
+ int dummy, int num, PointIdConstIterator first
+ );
+ virtual void BuildEdges( );
+ virtual void ClearPoints( );
+ virtual void SetPointId( int localId, PointIdentifier pId );
+
+ // Visitor methods
+ static int GetTopologyId( );
+ virtual void Accept(
+ CellIdentifier cellid,
+ typename itk::CellInterface< PixelType, CellTraits >::
+ MultiVisitor* mv
+ );
+
+ // Iterators
+ virtual PointIdIterator PointIdsBegin( );
+ virtual PointIdConstIterator PointIdsBegin( ) const;
+ virtual PointIdIterator PointIdsEnd( );
+ virtual PointIdConstIterator PointIdsEnd( ) const;
+
+ /// QuadEdgeCell-specific interface.
+ virtual E* GetEntryPrimalEdge( );
+ virtual const E* GetEntryPrimalEdge( ) const;
+ virtual void SetEntryPrimalEdge( E* entry );
+
+ private:
+ /// Purposely not implemented.
+ QuadEdgeCell( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ E* m_EntryEdge;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeCell.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGECELL__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGECELL__HXX__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGECELL__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGECELL__HXX__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGECELL__HXX__
// -------------------------------------------------------------------------
template< class I, class E >
-cpPlugins::Extensions::QuadEdgeCell< I, E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
QuadEdgeCell( )
: Superclass( ),
m_EntryEdge( NULL )
// -------------------------------------------------------------------------
template< class I, class E >
-cpPlugins::Extensions::QuadEdgeCell< I, E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
QuadEdgeCell( E* entry )
: Superclass( ),
m_EntryEdge( entry )
// -------------------------------------------------------------------------
template< class I, class E >
-cpPlugins::Extensions::QuadEdgeCell< I, E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
~QuadEdgeCell( )
{
}
// -------------------------------------------------------------------------
template< class I, class E >
-typename cpPlugins::Extensions::QuadEdgeCell< I, E >::
-CellGeometry cpPlugins::Extensions::QuadEdgeCell< I, E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
+CellGeometry cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetType( ) const
{
std::cout << "QuadEdgeCell GetType" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
MakeCopy( CellAutoPointer& other ) const
{
std::cout << "QuadEdgeCell MakeCopy" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-unsigned int cpPlugins::Extensions::QuadEdgeCell< I, E >::
+unsigned int cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetDimension( ) const
{
std::cout << "QuadEdgeCell GetDimension" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-unsigned int cpPlugins::Extensions::QuadEdgeCell< I, E >::
+unsigned int cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetNumberOfPoints( ) const
{
return( this->m_EntryEdge->GetLnextRingSize( ) );
// -------------------------------------------------------------------------
template< class I, class E >
-typename cpPlugins::Extensions::QuadEdgeCell< I, E >::
-CellFeatureCount cpPlugins::Extensions::QuadEdgeCell< I, E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
+CellFeatureCount cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetNumberOfBoundaryFeatures( int dimension ) const
{
std::cout << "QuadEdgeCell GetNumberOfBoundaryFeatures" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-bool cpPlugins::Extensions::QuadEdgeCell< I, E >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetBoundaryFeature(
int dimension,
CellFeatureIdentifier fId,
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
SetPointIds( PointIdConstIterator first )
{
std::cout << "QuadEdgeCell SetPointIds" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
SetPointIds(
PointIdConstIterator first,
PointIdConstIterator last
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
AddPointId( PointIdentifier pId )
{
std::cout << "QuadEdgeCell AddPointId" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
RemovePointId( PointIdentifier pId )
{
std::cout << "QuadEdgeCell RemovePointId" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
SetPointIds(
int dummy,
int num,
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
BuildEdges( )
{
std::cout << "QuadEdgeCell BuildEdges" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
ClearPoints( )
{
std::cout << "QuadEdgeCell ClearPoints" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
SetPointId( int localId, PointIdentifier pId )
{
std::cout << "QuadEdgeCell SetPointId(localId,pId)" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-int cpPlugins::Extensions::QuadEdgeCell< I, E >::
+int cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetTopologyId( )
{
// TODO: return( Superclass::POLYGON_CELL );
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
Accept(
CellIdentifier cellid,
typename itk::CellInterface< PixelType, CellTraits >::MultiVisitor* mv
// -------------------------------------------------------------------------
template< class I, class E >
-typename cpPlugins::Extensions::QuadEdgeCell< I, E >::
-PointIdIterator cpPlugins::Extensions::QuadEdgeCell< I, E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
+PointIdIterator cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
PointIdsBegin( )
{
std::cout << "QuadEdgeCell PointIdsBegin" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-typename cpPlugins::Extensions::QuadEdgeCell< I, E >::
-PointIdConstIterator cpPlugins::Extensions::QuadEdgeCell< I, E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
+PointIdConstIterator
+cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
PointIdsBegin( ) const
{
std::cout << "QuadEdgeCell PointIdsBegin (const)" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-typename cpPlugins::Extensions::QuadEdgeCell< I, E >::
-PointIdIterator cpPlugins::Extensions::QuadEdgeCell< I, E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
+PointIdIterator cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
PointIdsEnd( )
{
std::cout << "QuadEdgeCell PointIdsEnd" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-typename cpPlugins::Extensions::QuadEdgeCell< I, E >::
-PointIdConstIterator cpPlugins::Extensions::QuadEdgeCell< I, E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
+PointIdConstIterator
+cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
PointIdsEnd( ) const
{
std::cout << "QuadEdgeCell PointIdsEnd (const)" << std::endl;
// -------------------------------------------------------------------------
template< class I, class E >
-E* cpPlugins::Extensions::QuadEdgeCell< I, E >::
+E* cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetEntryPrimalEdge( )
{
return( this->m_EntryEdge );
// -------------------------------------------------------------------------
template< class I, class E >
-const E* cpPlugins::Extensions::QuadEdgeCell< I, E >::
+const E* cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
GetEntryPrimalEdge( ) const
{
return( this->m_EntryEdge );
// -------------------------------------------------------------------------
template< class I, class E >
-void cpPlugins::Extensions::QuadEdgeCell< I, E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeCell< I, E >::
SetEntryPrimalEdge( E* entry )
{
this->m_EntryEdge = entry;
}
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGECELL__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGECELL__HXX__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__H__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__H__
+
+#include <cstdlib>
+
+// -------------------------------------------------------------------------
+#define cpPluginsQEIteratorsMacro( op, it, cit ) \
+ inline it Begin##op( ) \
+ { return( it( this, it::Op##op, true ) ); } \
+ inline it End##op( ) \
+ { return( it( this, it::Op##op, false ) ); } \
+ inline cit Begin##op( ) const \
+ { return( cit( this, cit::Op##op, true ) ); } \
+ inline cit End##op( ) const \
+ { return( cit( this, cit::Op##op, false ) ); }
+
+// -------------------------------------------------------------------------
+#define cpPluginsExtensionsQEPointIteratorsMacro( op, it, cit ) \
+ inline Point##it BeginPoint##op( ) \
+ { return( Point##it( this, it::Op##op, true ) ); } \
+ inline Point##it EndPoint##op( ) \
+ { return( Point##it( this, it::Op##op, false ) ); } \
+ inline Point##cit BeginPoint##op( ) const \
+ { return( Point##cit( this, cit::Op##op, true ) ); } \
+ inline Point##cit EndPoint ##op( ) const \
+ { return( Point##cit( this, cit::Op##op, false ) ); }
+
+// -------------------------------------------------------------------------
+#define cpPluginsExtensionsQEAllIteratorsMacro( op ) \
+ cpPluginsQEIteratorsMacro( op, Iterator, ConstIterator ); \
+ cpPluginsExtensionsQEPointIteratorsMacro( op, Iterator, ConstIterator );
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace DataStructures
+ {
+ /**
+ */
+ template< class E >
+ class QuadEdgeBaseIterator
+ {
+ public:
+ typedef QuadEdgeBaseIterator Self;
+ typedef E TQuadEdge;
+
+ // Different types of logical iterators
+ enum
+ {
+ OpOnext = 0,
+ OpLnext = 1,
+ OpRnext = 2,
+ OpDnext = 3,
+ OpOprev = 4,
+ OpLprev = 5,
+ OpRprev = 6,
+ OpDprev = 7
+ };
+
+ public:
+ QuadEdgeBaseIterator( E* e, int op = OpOnext, bool start = true );
+ virtual ~QuadEdgeBaseIterator( );
+ Self& operator=( const Self& r );
+
+ E* GetStartEdge( ) const;
+ E* GetIterator( ) const;
+ int GetOpType( ) const;
+ bool GetStart( ) const;
+
+ bool operator==( Self& r );
+ bool operator==( const Self& r ) const;
+ bool operator!=( Self& r );
+ bool operator!=( const Self& r ) const;
+ Self& operator++( );
+ Self& operator++( int );
+
+ protected:
+ /// Method that should do all the iteration work
+ virtual void _GoToNext( );
+
+ protected:
+ E* m_StartEdge; /**< Start edge */
+ E* m_Iterator; /**< Current iteration position */
+ int m_OpType; /**< Operation type */
+ bool m_Start; /**< Indicates iteration has just started */
+ };
+
+ /**
+ */
+ template< class E >
+ class QuadEdgeIterator
+ : public QuadEdgeBaseIterator< E >
+ {
+ public:
+ typedef QuadEdgeIterator Self;
+ typedef QuadEdgeBaseIterator< E > Superclass;
+ typedef E TQuadEdge;
+
+ public:
+ QuadEdgeIterator(
+ E* e = NULL, int op = Superclass::OpOnext, bool start = true
+ );
+ virtual ~QuadEdgeIterator( );
+ E* operator*( );
+ };
+
+ /**
+ */
+ template< class E >
+ class QuadEdgeConstIterator
+ : public QuadEdgeBaseIterator< const E >
+ {
+ public:
+ typedef QuadEdgeConstIterator Self;
+ typedef QuadEdgeBaseIterator< const E > Superclass;
+ typedef E TQuadEdge;
+
+ public:
+ QuadEdgeConstIterator(
+ const E* e = NULL, int op = Superclass::OpOnext, bool start = true
+ );
+ virtual ~QuadEdgeConstIterator( );
+ const E* operator*( ) const;
+ };
+
+ /**
+ */
+ template< class E >
+ class QuadEdgePointIterator
+ : public QuadEdgeBaseIterator< const E >
+ {
+ public:
+ typedef QuadEdgePointIterator Self;
+ typedef QuadEdgeBaseIterator< const E > Superclass;
+ typedef E TQuadEdge;
+
+ public:
+ QuadEdgePointIterator(
+ const E* e = NULL, int op = Superclass::OpOnext, bool start = true
+ );
+ virtual ~QuadEdgePointIterator( );
+ typename E::TPrimalGeometry& operator*( );
+ };
+
+ /**
+ */
+ template< class E >
+ class QuadEdgePointConstIterator
+ : public QuadEdgeBaseIterator< const E >
+ {
+ public:
+ typedef QuadEdgePointConstIterator Self;
+ typedef QuadEdgeBaseIterator< const E > Superclass;
+ typedef E TQuadEdge;
+
+ public:
+ QuadEdgePointConstIterator(
+ const E* e = NULL, int op = Superclass::OpOnext, bool start = true
+ );
+ virtual ~QuadEdgePointConstIterator( );
+ const typename E::TPrimalGeometry& operator*( ) const;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeIterators.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGEITERATORS__HXX__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGEITERATORS__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__HXX__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__HXX__
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
QuadEdgeBaseIterator( E* e, int op, bool start )
: m_StartEdge( e ),
m_Iterator( e ),
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
~QuadEdgeBaseIterator( )
{
}
// -------------------------------------------------------------------------
template< class E >
-typename cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
-Self& cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
+Self& cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator=( const Self& r )
{
if( this != &r )
// -------------------------------------------------------------------------
template< class E >
-E* cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+E* cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
GetStartEdge( ) const
{
return( this->m_StartEdge );
// -------------------------------------------------------------------------
template< class E >
-E* cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+E* cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
GetIterator( ) const
{
return( this->m_Iterator );
// -------------------------------------------------------------------------
template< class E >
-int cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+int cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
GetOpType( ) const
{
return( this->m_OpType );
// -------------------------------------------------------------------------
template< class E >
-bool cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
GetStart( ) const
{
return( this->m_Start );
// -------------------------------------------------------------------------
template< class E >
-bool cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator==( Self& r )
{
return(
// -------------------------------------------------------------------------
template< class E >
-bool cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator==( const Self& r ) const
{
return(
// -------------------------------------------------------------------------
template< class E >
-bool cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator!=( Self& r )
{
return( !( this->operator==( r ) ) );
// -------------------------------------------------------------------------
template< class E >
-bool cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator!=( const Self& r ) const
{
return( !( this->operator==( r ) ) );
// -------------------------------------------------------------------------
template< class E >
-typename cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
-Self& cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
+Self& cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator++( )
{
if( this->m_Start )
// -------------------------------------------------------------------------
template< class E >
-typename cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
-Self& cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
+Self& cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
operator++( int )
{
if( this->m_Start )
// -------------------------------------------------------------------------
template< class E >
-void cpPlugins::Extensions::QuadEdgeBaseIterator< E >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeBaseIterator< E >::
_GoToNext( )
{
switch( this->m_OpType )
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgeIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeIterator< E >::
QuadEdgeIterator( E* e, int op, bool start )
: Superclass( e, op, start )
{
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgeIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeIterator< E >::
~QuadEdgeIterator( )
{
}
// -------------------------------------------------------------------------
template< class E >
-E* cpPlugins::Extensions::QuadEdgeIterator< E >::
+E* cpPlugins::Extensions::DataStructures::QuadEdgeIterator< E >::
operator*( )
{
return( this->m_Iterator );
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgeConstIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeConstIterator< E >::
QuadEdgeConstIterator( const E* e, int op, bool start )
: Superclass( e, op, start )
{
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgeConstIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgeConstIterator< E >::
~QuadEdgeConstIterator( )
{
}
// -------------------------------------------------------------------------
template< class E >
-const E* cpPlugins::Extensions::QuadEdgeConstIterator< E >::
+const E* cpPlugins::Extensions::DataStructures::QuadEdgeConstIterator< E >::
operator*( ) const
{
return( this->m_Iterator );
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgePointIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgePointIterator< E >::
QuadEdgePointIterator( const E* e, int op, bool start )
: Superclass( e, op, start )
{
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgePointIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgePointIterator< E >::
~QuadEdgePointIterator( )
{
}
// -------------------------------------------------------------------------
template< class E >
typename E::TPrimalGeometry&
-cpPlugins::Extensions::QuadEdgePointIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgePointIterator< E >::
operator*( )
{
return( this->m_Iterator->GetOrigin( ) );
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgePointConstIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgePointConstIterator< E >::
QuadEdgePointConstIterator( const E* e, int op, bool start )
: Superclass( e, op, start )
{
// -------------------------------------------------------------------------
template< class E >
-cpPlugins::Extensions::QuadEdgePointConstIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgePointConstIterator< E >::
~QuadEdgePointConstIterator( )
{
}
// -------------------------------------------------------------------------
template< class E >
const typename E::TPrimalGeometry&
-cpPlugins::Extensions::QuadEdgePointConstIterator< E >::
+cpPlugins::Extensions::DataStructures::QuadEdgePointConstIterator< E >::
operator*( ) const
{
return( this->m_Iterator->GetOrigin( ) );
}
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGEITERATORS__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEITERATORS__HXX__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
+
+#include <set>
+#include <vector>
+
+#include <itkMesh.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeCell.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdge.h>
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace DataStructures
+ {
+ /**
+ */
+ template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > >
+ class QuadEdgeMesh
+ : public itk::Mesh< P, D, T >
+ {
+ public:
+ typedef QuadEdgeMesh Self;
+ typedef itk::Mesh< P, D, T > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ /// Types from superclass
+ typedef typename
+ Superclass::BoundaryAssignmentsContainer
+ BoundaryAssignmentsContainer;
+
+ typedef typename
+ Superclass::BoundaryAssignmentsContainerPointer
+ BoundaryAssignmentsContainerPointer;
+
+ typedef typename Superclass::BoundingBoxType BoundingBoxType;
+ typedef typename Superclass::CellAutoPointer CellAutoPointer;
+ typedef typename Superclass::CellsContainer CellsContainer;
+ typedef typename Superclass::CellDataContainer CellDataContainer;
+ typedef typename Superclass::CellFeatureCount CellFeatureCount;
+ typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
+ typedef typename Superclass::CellIdentifier CellIdentifier;
+ typedef typename Superclass::CellLinksContainer CellLinksContainer;
+ typedef typename Superclass::CellMultiVisitorType CellMultiVisitorType;
+ typedef typename Superclass::CellPixelType CellPixelType;
+ typedef typename Superclass::CellType CellType;
+ typedef typename Superclass::PointIdentifier PointIdentifier;
+ typedef typename Superclass::PointsContainer PointsContainer;
+ typedef typename Superclass::PointType PointType;
+
+ /// QuadEdge types (primal and dual)
+ typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge;
+ typedef typename TPrimalEdge::TDual TDualEdge;
+ typedef QuadEdgeCell< CellType, TPrimalEdge > TQuadEdgeCell;
+
+ /// Memory management objects
+ typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges;
+ typedef std::set< typename TDualEdge::Pointer > CntDualEdges;
+ typedef std::vector< TPrimalEdge* > CntOnextRings;
+
+ /// More geometry types
+ typedef typename PointType::VectorType VectorType;
+ typedef typename VectorType::ValueType TScalar;
+ typedef std::vector< VectorType > CntNormals;
+ typedef typename CntNormals::const_iterator NormalsIterator;
+
+ protected:
+ typedef std::vector< TPrimalEdge* > _TEdges;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( QuadEdgeMesh, itkMesh );
+
+ public:
+ // Edge related methods
+ TPrimalEdge* FindEdge( const PointIdentifier& a ) const;
+ TPrimalEdge* FindEdge(
+ const PointIdentifier& a, const PointIdentifier& b
+ ) const;
+ TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const;
+
+ /// New geometric methods
+ const CntNormals& GetPointNormalsContainer( ) const;
+ NormalsIterator BeginPointNormals( ) const;
+ NormalsIterator EndPointNormals( ) const;
+ const VectorType& GetPointNormal( const PointIdentifier& id ) const;
+
+ /// itk::DataObject methods overloading
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
+
+ /// itk::PointSet methods overloading
+ virtual void SetPoints( PointsContainer* points );
+ virtual void SetPoint( PointIdentifier id , PointType point );
+
+ /// itk::Mesh methods overloading
+ virtual void PassStructure( Self* inputMesh )
+ {
+ std::cout << "PassStructure" << std::endl;
+ std::exit( 1 );
+ }
+
+ virtual void Initialize( );
+ virtual void Graft( const itk::DataObject* data );
+
+ void SetCellLinks( CellLinksContainer* cellLinks )
+ {
+ std::cout << "SetCellLinks" << std::endl;
+ std::exit( 1 );
+ }
+ virtual CellLinksContainer* GetCellLinks( )
+ {
+ std::cout << "GetCellLinks" << std::endl;
+ std::exit( 1 );
+ }
+ virtual const CellLinksContainer* GetCellLinks( ) const
+ {
+ std::cout << "GetCellLinks (const)" << std::endl;
+ std::exit( 1 );
+ }
+ virtual void SetCells( CellsContainer* cells );
+ virtual void SetCellData( CellDataContainer* data );
+ virtual CellDataContainer* GetCellData( )
+ {
+ std::cout << "GetCellData" << std::endl;
+ std::exit( 1 );
+ }
+ virtual const CellDataContainer* GetCellData( ) const
+ {
+ std::cout << "GetCellData (const)" << std::endl;
+ std::exit( 1 );
+ }
+
+#if !defined( CABLE_CONFIGURATION )
+ virtual void SetBoundaryAssignments(
+ int dimension, BoundaryAssignmentsContainer* container
+ )
+ {
+ std::cout << "SetBoundaryAssignments" << std::endl;
+ std::exit( 1 );
+ }
+ virtual BoundaryAssignmentsContainerPointer
+ GetBoundaryAssignments( int dimension )
+ {
+ std::cout << "GetBoundaryAssignments" << std::endl;
+ std::exit( 1 );
+ }
+ virtual const BoundaryAssignmentsContainerPointer
+ GetBoundaryAssignments( int dimension ) const
+ {
+ std::cout << "GetBoundaryAssignments (const)" << std::endl;
+ std::exit( 1 );
+ }
+#endif
+
+ virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr );
+ virtual void SetCellData( CellIdentifier id, CellPixelType data );
+ virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const
+ {
+ std::cout << "GetCellData" << std::endl;
+ std::exit( 1 );
+ }
+ virtual void SetBoundaryAssignment(
+ int dimension, CellIdentifier cellId,
+ CellFeatureIdentifier featureId,
+ CellIdentifier boundaryId
+ )
+ {
+ std::cout << "SetBoundaryAssignment" << std::endl;
+ std::exit( 1 );
+ }
+ virtual bool GetBoundaryAssignment(
+ int dimension, CellIdentifier cellId,
+ CellFeatureIdentifier featureId,
+ CellIdentifier* boundaryId
+ ) const
+ {
+ std::cout << "GetBoundaryAssignment" << std::endl;
+ std::exit( 1 );
+ }
+ virtual bool RemoveBoundaryAssignment(
+ int dimension, CellIdentifier cellId,
+ CellFeatureIdentifier featureId
+ )
+ {
+ std::cout << "RemoveBoundaryAssignment" << std::endl;
+ std::exit( 1 );
+ }
+ virtual CellFeatureCount GetNumberOfCellBoundaryFeatures(
+ int dimension,
+ CellIdentifier id
+ ) const
+ {
+ std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl;
+ std::exit( 1 );
+ }
+ virtual bool GetCellBoundaryFeature(
+ int dimension, CellIdentifier id,
+ CellFeatureIdentifier fid,
+ CellAutoPointer& ptr
+ ) const
+ {
+ std::cout << "GetCellBoundaryFeature" << std::endl;
+ std::exit( 1 );
+ }
+ virtual CellIdentifier GetCellBoundaryFeatureNeighbors(
+ int dimension,
+ CellIdentifier id,
+ CellFeatureIdentifier fid,
+ std::set< CellIdentifier >* cellSet )
+ {
+ std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl;
+ std::exit( 1 );
+ }
+ virtual CellIdentifier GetCellNeighbors(
+ CellIdentifier cellId,
+ std::set< CellIdentifier >* cellSet
+ )
+ {
+ std::cout << "GetCellNeighbors" << std::endl;
+ std::exit( 1 );
+ }
+ virtual bool GetAssignedCellBoundaryIfOneExists(
+ int dimension, CellIdentifier id,
+ CellFeatureIdentifier fid,
+ CellAutoPointer& ptr
+ ) const
+ {
+ std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl;
+ std::exit( 1 );
+ }
+ virtual void BuildCellLinks( ) const;
+
+ virtual void Accept( CellMultiVisitorType* mv ) const
+ {
+ std::cout << "Accept" << std::endl;
+ std::exit( 1 );
+ }
+
+ protected:
+ QuadEdgeMesh( );
+ virtual ~QuadEdgeMesh( );
+
+ virtual void ReleaseCellsMemory( )
+ {
+ std::cout << "ReleaseCellsMemory" << std::endl;
+ std::exit( 1 );
+ }
+
+ inline bool _CheckPoints( const CellAutoPointer& ptr ) const;
+ inline void _DeletePoint( const PointIdentifier& pId );
+ inline TPrimalEdge* _CreateQuadEdge(
+ const PointIdentifier& a, const PointIdentifier& b
+ );
+ inline void _DeleteEdge( TPrimalEdge* edge );
+ inline void _DeleteFace( const CellIdentifier& f );
+ inline void _ConstructEdges(
+ _TEdges& edges, const CellAutoPointer& ptr
+ );
+ virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const;
+ inline void _ReleaseQuadEdgeObjects( );
+
+ private:
+ QuadEdgeMesh( const Self& ); // Not implemented
+ void operator=( const Self& ); // Not implemented
+
+ protected:
+ CntPrimalEdges m_PrimalEdges;
+ CntDualEdges m_DualEdges;
+
+ CntOnextRings m_OnextRings;
+
+ CntNormals m_PointNormals;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGEMESH__HXX__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGEMESH__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__HXX__
+#define __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__HXX__
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-TPrimalEdge* cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+TPrimalEdge* cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
FindEdge( const PointIdentifier& a ) const
{
if( a < this->m_OnextRings.size( ) )
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-TPrimalEdge* cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+TPrimalEdge* cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
FindEdge( const PointIdentifier& a, const PointIdentifier& b ) const
{
TPrimalEdge* found = NULL;
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-TPrimalEdge* cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+TPrimalEdge* cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
FindEntryEdge( const CellIdentifier& i ) const
{
if( i < this->GetNumberOfCells( ) )
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-const typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-CntNormals& cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+const typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+CntNormals& cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
GetPointNormalsContainer( ) const
{
return( this->m_PointNormals );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-NormalsIterator cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+NormalsIterator cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
BeginPointNormals( ) const
{
return( this->m_PointNormals.begin( ) );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-NormalsIterator cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+NormalsIterator cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
EndPointNormals( ) const
{
return( this->m_PointNormals.end( ) );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-const typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-VectorType& cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+const typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+VectorType& cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
GetPointNormal( const PointIdentifier& id ) const
{
static const VectorType zero( TScalar( 0 ) );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-bool cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
RequestedRegionIsOutsideOfTheBufferedRegion( )
{
// Mesh regions don't have meaning with QuadEdges, this is important
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
SetPoints( PointsContainer* points )
{
this->_ReleaseQuadEdgeObjects( );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
SetPoint( PointIdentifier id , PointType point )
{
// If the point is brand new, add some non-existent edges and normals
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
Initialize( )
{
this->Superclass::Initialize( );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
Graft( const itk::DataObject* data )
{
this->Superclass::Graft( data );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
SetCells( CellsContainer* cells )
{
// Clear cells
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
SetCellData( CellDataContainer* data )
{
/* TODO
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
SetCell( CellIdentifier id, CellAutoPointer& ptr )
{
// Overwrite an existing cell?
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
SetCellData( CellIdentifier id, CellPixelType data )
{
/* TODO
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
BuildCellLinks( ) const
{
// This is no longer required when using QuadEdges
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
QuadEdgeMesh( )
: Superclass( )
{
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
~QuadEdgeMesh( )
{
this->_ReleaseQuadEdgeObjects( );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-bool cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+bool cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_CheckPoints( const CellAutoPointer& ptr ) const
{
const typename Superclass::PointsContainer* pnts = this->GetPoints( );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_DeletePoint( const PointIdentifier& pId )
{
PointIdentifier lastId = this->GetNumberOfPoints( ) - 1;
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-TPrimalEdge* cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+typename cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
+TPrimalEdge* cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_CreateQuadEdge( const PointIdentifier& a, const PointIdentifier& b )
{
// Create brand new object
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_DeleteEdge( TPrimalEdge* edge )
{
this->m_DualEdges.erase( edge->GetInvRot( ) );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_DeleteFace( const CellIdentifier& f )
{
unsigned long cellId = this->GetNumberOfCells( ) - 1;
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_ConstructEdges( _TEdges& edges, const CellAutoPointer& ptr )
{
edges.clear( );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-typename cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
-VectorType cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+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 );
// -------------------------------------------------------------------------
template< typename P, unsigned int D, typename T >
-void cpPlugins::Extensions::QuadEdgeMesh< P, D, T >::
+void cpPlugins::Extensions::DataStructures::QuadEdgeMesh< P, D, T >::
_ReleaseQuadEdgeObjects( )
{
this->m_PrimalEdges.clear( );
this->m_PointNormals.clear( );
}
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGEMESH__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__DATASTRUCTURES__QUADEDGEMESH__HXX__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__IO__MESHREADER__H__
+#define __CPPLUGINS__EXTENSIONS__IO__MESHREADER__H__
+
+#include <string>
+#include <itkMeshSource.h>
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace IO
+ {
+ /**
+ */
+ template< typename M >
+ class MeshReader
+ : public itk::MeshSource< M >
+ {
+ public:
+ typedef MeshReader Self;
+ typedef itk::MeshSource< M > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef M MeshType;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( MeshReader, itkMeshSource );
+
+ itkSetStringMacro( FileName );
+ itkGetStringMacro( FileName );
+
+ public:
+ virtual itk::ModifiedTimeType GetMTime( ) const;
+
+ protected:
+ MeshReader( );
+ virtual ~MeshReader( );
+
+ virtual void GenerateData( );
+
+ template< class R >
+ void _Read( );
+
+ private:
+ // Purposely not implemented
+ MeshReader( const Self& );
+ Self& operator=( const Self & );
+
+ protected:
+ typename Superclass::Pointer m_Reader;
+ std::string m_FileName;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/IO/MeshReader.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__IO__MESHREADER__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__MESHREADER__HXX__
-#define __CPPLUGINS__EXTENSIONS__MESHREADER__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__IO__MESHREADER__HXX__
+#define __CPPLUGINS__EXTENSIONS__IO__MESHREADER__HXX__
#include <algorithm>
-#include <cpPlugins/Extensions/WaveFrontOBJReader.h>
+#include <cpPlugins/Extensions/IO/WaveFrontOBJReader.h>
#include <itkVTKPolyDataReader.h>
// -------------------------------------------------------------------------
template< typename M >
-itk::ModifiedTimeType cpPlugins::Extensions::MeshReader< M >::
+itk::ModifiedTimeType cpPlugins::Extensions::IO::MeshReader< M >::
GetMTime( ) const
{
itk::ModifiedTimeType mtime = this->Superclass::GetMTime( );
// -------------------------------------------------------------------------
template< typename M >
-cpPlugins::Extensions::MeshReader< M >::
+cpPlugins::Extensions::IO::MeshReader< M >::
MeshReader( )
: Superclass( )
{
// -------------------------------------------------------------------------
template< typename M >
-cpPlugins::Extensions::MeshReader< M >::
+cpPlugins::Extensions::IO::MeshReader< M >::
~MeshReader( )
{
}
// -------------------------------------------------------------------------
template< typename M >
-void cpPlugins::Extensions::MeshReader< M >::
+void cpPlugins::Extensions::IO::MeshReader< M >::
GenerateData( )
{
std::string fn = this->m_FileName;
if( fn.rfind( ".vtk" ) != std::string::npos )
this->_Read< itk::VTKPolyDataReader< M > >( );
else if( fn.rfind( ".obj" ) != std::string::npos )
- this->_Read< cpPlugins::Extensions::WaveFrontOBJReader< M > >( );
+ this->_Read< cpPlugins::Extensions::IO::WaveFrontOBJReader< M > >( );
}
// -------------------------------------------------------------------------
template< typename M >
template< class R >
-void cpPlugins::Extensions::MeshReader< M >::
+void cpPlugins::Extensions::IO::MeshReader< M >::
_Read( )
{
typename R::Pointer reader = NULL;
} // fi
}
-#endif // __CPPLUGINS__EXTENSIONS__MESHREADER__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__IO__MESHREADER__HXX__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__H__
+#define __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__H__
+
+#include <string>
+#include <itkIntTypes.h>
+#include <itkMesh.h>
+#include <itkMeshSource.h>
+#include <itkPolygonCell.h>
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace IO
+ {
+ /**
+ * \class WaveFrontOBJReader
+ * \brief
+ * Reads a wavefront OBJ file and create an itkMesh.
+ *
+ * Caveat1: itkWaveFrontOBJReader will read only vertices and faces.
+ * Normal, parameters and textures vectors are ignored.
+ *
+ */
+ template< typename M >
+ class WaveFrontOBJReader
+ : public itk::MeshSource< M >
+ {
+ public:
+ typedef WaveFrontOBJReader Self;
+ typedef itk::MeshSource< M > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef M MeshType;
+ typedef typename M::MeshTraits MeshTraits;
+ typedef typename M::PointType PointType;
+ typedef typename MeshTraits::PixelType PixelType;
+ typedef typename M::Pointer MeshPointer;
+ typedef typename M::CellTraits CellTraits;
+ typedef typename M::CellIdentifier CellIdentifier;
+ typedef typename M::CellType CellType;
+ typedef typename M::CellAutoPointer CellAutoPointer;
+ typedef typename M::PointIdentifier PointIdentifier;
+ typedef typename CellTraits::PointIdIterator PointIdIterator;
+ typedef typename M::PointsContainerPointer PointsContainerPointer;
+ typedef typename M::PointsContainer PointsContainer;
+
+ typedef itk::PolygonCell< CellType > TPolygonCell;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( WaveFrontOBJReader, itkMeshSource );
+
+ itkSetStringMacro( FileName );
+ itkGetStringMacro( FileName );
+
+ protected:
+ WaveFrontOBJReader( );
+ virtual ~WaveFrontOBJReader( );
+
+ virtual void GenerateData( );
+
+ private:
+ // Purposely not implemented
+ WaveFrontOBJReader( const Self& );
+ Self& operator=( const Self & );
+
+ protected:
+ std::string m_FileName;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/IO/WaveFrontOBJReader.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__WAVEFRONTOBJREADER__HXX__
-#define __CPPLUGINS__EXTENSIONS__WAVEFRONTOBJREADER__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__HXX__
+#define __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__HXX__
#include <cstdlib>
#include <fstream>
// -------------------------------------------------------------------------
template< typename M >
-cpPlugins::Extensions::WaveFrontOBJReader< M >::
+cpPlugins::Extensions::IO::WaveFrontOBJReader< M >::
WaveFrontOBJReader( )
: Superclass( )
{
// -------------------------------------------------------------------------
template< typename M >
-cpPlugins::Extensions::WaveFrontOBJReader< M >::
+cpPlugins::Extensions::IO::WaveFrontOBJReader< M >::
~WaveFrontOBJReader( )
{
}
// -------------------------------------------------------------------------
template< typename M >
-void cpPlugins::Extensions::WaveFrontOBJReader< M >::
+void cpPlugins::Extensions::IO::WaveFrontOBJReader< M >::
GenerateData( )
{
typedef typename PointType::ValueType TScalar;
in.close( );
}
-#endif // __CPPLUGINS__EXTENSIONS__WAVEFRONTOBJREADER__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__IO__WAVEFRONTOBJREADER__HXX__
// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__MESHMAPPER__H__
-#define __CPPLUGINS__EXTENSIONS__MESHMAPPER__H__
-
-#include <itkConceptChecking.h>
-#include <vtkMapper.h>
-
-class vtkActor;
-class vtkInformation;
-class vtkRenderer;
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< class M >
- class MeshMapper
- : public vtkMapper
- {
- public:
- typedef MeshMapper Self;
- vtkTypeMacro( MeshMapper, vtkMapper );
-
- typedef M TMesh;
- typedef typename M::PointType TPoint;
- typedef typename TPoint::VectorType TVector;
- typedef typename TPoint::CoordRepType TScalar;
- itkStaticConstMacro( Dimension, unsigned int, M::PointDimension );
-
- // Begin concept checking
-#ifdef ITK_USE_CONCEPT_CHECKING
- /* TODO
- itkConceptMacro(
- InputMeshIsTwoOrThreeimensionalCheck,
- ( itk::Concept::SameDimensionOrMinusOne< Self::Dimension, 3 > )
- );
- itkConceptMacro(
- ScalarTypeHasFloatResolution,
- ( itk::Concept::IsFloatingPoint< TScalar > )
- );
- */
-#endif
- // End concept checking
-
- public:
- // TODO: static Self* New( );
- virtual void ShallowCopy( vtkAbstractMapper* m );
-
- virtual void SetInputData( M* in );
- virtual M* GetInput( );
- virtual const M* GetInput( ) const;
-
- virtual double* GetBounds( );
- virtual void GetBounds( double bounds[ 6 ] );
-
- virtual void RenderPiece( vtkRenderer* aren, vtkActor* act ) = 0;
- virtual void Render( vtkRenderer* aren, vtkActor* act );
- virtual void Update( );
- virtual void Update( int port );
-
- virtual void MapDataArrayToVertexAttribute(
- const char* vertexAttributeName,
- const char* dataArrayName,
- int fieldAssociation,
- int componentno = -1
- );
- virtual void MapDataArrayToMultiTextureAttribute(
- int unit,
- const char* dataArrayName,
- int fieldAssociation,
- int componentno = -1
- );
- virtual void RemoveVertexAttributeMapping(
- const char* vertexAttributeName
- );
- virtual void RemoveAllVertexAttributeMappings( );
-
- protected:
- MeshMapper( );
- virtual ~MeshMapper( );
-
- virtual void ComputeBounds( );
- virtual int FillInputPortInformation( int port, vtkInformation* info );
-
- private:
- // These methods aren't supposed to be implemented
- MeshMapper( const Self& other );
- Self& operator=( const Self& other );
-
- protected:
- typename M::Pointer Mesh;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/MeshMapper.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__MESHMAPPER__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__MESHREADER__H__
-#define __CPPLUGINS__EXTENSIONS__MESHREADER__H__
-
-#include <string>
-#include <itkMeshSource.h>
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< typename M >
- class MeshReader
- : public itk::MeshSource< M >
- {
- public:
- typedef MeshReader Self;
- typedef itk::MeshSource< M > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- typedef M MeshType;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( MeshReader, itkMeshSource );
-
- itkSetStringMacro( FileName );
- itkGetStringMacro( FileName );
-
- public:
- virtual itk::ModifiedTimeType GetMTime( ) const;
-
- protected:
- MeshReader( );
- virtual ~MeshReader( );
-
- virtual void GenerateData( );
-
- template< class R >
- void _Read( );
-
- private:
- // Purposely not implemented
- MeshReader( const Self& );
- Self& operator=( const Self & );
-
- protected:
- typename Superclass::Pointer m_Reader;
- std::string m_FileName;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/MeshReader.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__MESHREADER__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__OPENGLMESHMAPPER__H__
-#define __CPPLUGINS__EXTENSIONS__OPENGLMESHMAPPER__H__
-
-#include <vector>
-
-/*
- #include <vtkRenderWindow.h>
- #include <vtkSmartPointer.h>
-*/
-
-#include <cpPlugins/Extensions/MeshMapper.h>
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< class M >
- class OpenGLMeshMapper
- : public MeshMapper< M >
- {
- public:
- typedef OpenGLMeshMapper Self;
- vtkTypeMacro( OpenGLMeshMapper, MeshMapper< M > );
-
- typedef typename Superclass::TMesh TMesh;
- typedef typename Superclass::TPoint TPoint;
- typedef typename Superclass::TVector TVector;
- typedef typename Superclass::TScalar TScalar;
-
- protected:
- typedef unsigned int TIndex;
- typedef typename M::CellType TCell;
- typedef typename M::CellsContainer TCellsContainer;
- typedef typename TCellsContainer::ConstIterator TCellIt;
-
- public:
- virtual const char* GetNameOfClass( ) const
- { return( "cpPlugins::Extensions::OpenGLMeshMapper" ); }
- static Self* New( );
-
- virtual void RenderPiece( vtkRenderer* aren, vtkActor* act );
- virtual void ReleaseGraphicsResources( vtkWindow* win );
- virtual int Draw( vtkRenderer* aren, vtkActor* act );
-
- protected:
- OpenGLMeshMapper( );
- virtual ~OpenGLMeshMapper( );
-
- bool _ConfigureOpenGL( );
-
- private:
- // Purposely not implemented
- OpenGLMeshMapper( const Self& other );
- Self& operator=( const Self& other );
-
- protected:
- vtkIdType TotalCells;
- // TODO: vtkSmartPointer< vtkOpenGLTexture > InternalColorTexture;
-
- bool FirstRendering;
-
- bool VBOSupported;
- unsigned int VBOID1, VBOID2;
-
- std::vector< unsigned int > Sizes;
- std::vector< TIndex > Indices;
- long IndexElementType;
- long ElementValueType;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/OpenGLMeshMapper.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__OPENGLMESHMAPPER__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGE__H__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGE__H__
-
-#include <itkLightObject.h>
-#include <cpPlugins/Extensions/QuadEdgeIterators.h>
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< typename P, typename D, bool IsPrimal = true >
- class QuadEdge
- : public itk::LightObject
- {
- public:
- typedef QuadEdge Self;
- typedef itk::LightObject Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- /// Vertices and faces types
- typedef P TPrimalGeometry;
- typedef D TDualGeometry;
-
- /**
- * Dual type, basically the same type with swapped template
- * parameters.
- */
- typedef QuadEdge< D, P, !IsPrimal > TDual;
- typedef Self TPrimal;
- typedef typename TDual::Pointer PtrDual;
- friend TDual;
-
- /// Iterators
- typedef QuadEdgeIterator< TPrimal > Iterator;
- typedef QuadEdgeConstIterator< TPrimal > ConstIterator;
- typedef QuadEdgePointIterator< TPrimal > PointIterator;
- typedef QuadEdgePointConstIterator< TPrimal > PointConstIterator;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( QuadEdge, itkLightObject );
-
- cpPluginsExtensionsQEAllIteratorsMacro( Onext );
- cpPluginsExtensionsQEAllIteratorsMacro( Lnext );
- cpPluginsExtensionsQEAllIteratorsMacro( Rnext );
- cpPluginsExtensionsQEAllIteratorsMacro( Dnext );
- cpPluginsExtensionsQEAllIteratorsMacro( Oprev );
- cpPluginsExtensionsQEAllIteratorsMacro( Lprev );
- cpPluginsExtensionsQEAllIteratorsMacro( Rprev );
- cpPluginsExtensionsQEAllIteratorsMacro( Dprev );
-
- public:
- void CreateRings( );
-
- /// First order access methods
- inline TPrimal* GetOnext( )
- { return( this->m_Onext ); }
- inline TDual* GetRot( )
- { return( this->m_Rot ); }
- inline const TPrimal* GetOnext( ) const
- { return( this->m_Onext ); }
- inline const TDual* GetRot( ) const
- { return( this->m_Rot ); }
-
- /// First order configuration methods
- inline void SetOnext( TPrimal* e )
- { this->m_Onext = e; }
- inline void SetRot( TDual* e )
- { this->m_Rot = e; }
-
- /// Second order accessors: around base rings
- inline TPrimal* GetSym( )
- { return( this->m_Rot->m_Rot ); }
- inline TDual* GetInvRot( )
- { return( this->m_Rot->m_Rot->m_Rot ); }
-
- /// Second order accessors: neighboring topology
- inline TPrimal* GetLnext( )
- { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
- inline TPrimal* GetRnext( )
- { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
- inline TPrimal* GetDnext( )
- { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
- inline TPrimal* GetOprev( )
- { return( this->m_Rot->m_Onext->m_Rot ); }
- inline TPrimal* GetLprev( )
- { return( this->m_Onext->m_Rot->m_Rot ); }
- inline TPrimal* GetRprev( )
- { return( this->m_Rot->m_Rot->m_Onext ); }
- inline TPrimal* GetDprev( )
- { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
-
- /// Second order accessors: around base rings (const versions)
- inline const TPrimal* GetSym( ) const
- { return( this->m_Rot->m_Rot ); }
- inline const TDual* GetInvRot( ) const
- { return( this->m_Rot->m_Rot->m_Rot ); }
-
- /// Second order accessors: neighboring topology (const versions)
- inline const TPrimal* GetLnext( ) const
- { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot ); }
- inline const TPrimal* GetRnext( ) const
- { return( this->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
- inline const TPrimal* GetDnext( ) const
- { return( this->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot ); }
- inline const TPrimal* GetOprev( ) const
- { return( this->m_Rot->m_Onext->m_Rot ); }
- inline const TPrimal* GetLprev( ) const
- { return( this->m_Onext->m_Rot->m_Rot ); }
- inline const TPrimal* GetRprev( ) const
- { return( this->m_Rot->m_Rot->m_Onext ); }
- inline const TPrimal* GetDprev( ) const
- { return( this->m_Rot->m_Rot->m_Rot->m_Onext->m_Rot->m_Rot->m_Rot ); }
-
- /// Get geometry methods
- inline P& GetOrigin( )
- { return ( this->m_Origin ); }
- inline P& GetDestination( )
- { return ( this->m_Rot->m_Rot->m_Origin ); }
- inline D& GetRight( )
- { return ( this->m_Rot->m_Origin ); }
- inline D& GetLeft( )
- { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
-
- /// Get geometry methods (const versions)
- inline const P& GetOrigin( ) const
- { return ( this->m_Origin ); }
- inline const P& GetDestination( ) const
- { return ( this->m_Rot->m_Rot->m_Origin ); }
- inline const D& GetRight( ) const
- { return ( this->m_Rot->m_Origin ); }
- inline const D& GetLeft( ) const
- { return ( this->m_Rot->m_Rot->m_Rot->m_Origin ); }
-
- /// Set geometry methods
- inline void SetOrigin( const P& v )
- { this->m_Origin = v; }
- inline void SetDestination( const P& v )
- { this->m_Rot->m_Rot->m_Origin = v; }
- inline void SetRight( const D& v )
- { this->m_Rot->m_Origin = v; }
- inline void SetLeft( const D& v )
- { this->m_Rot->m_Rot->m_Rot->m_Origin = v; }
- inline void UnsetOrigin( )
- { this->m_Origin = TPrimal::NoGeometry; }
- inline void UnsetDestination( )
- { this->m_Rot->m_Rot->m_Origin = TPrimal::NoGeometry; }
- inline void UnsetRight( )
- { this->m_Rot->m_Origin = TDual::NoGeometry; }
- inline void UnsetLeft( )
- { this->m_Rot->m_Rot->m_Rot->m_Origin = TDual::NoGeometry; }
-
- /**
- * Set the Left( ) of all the edges in the Lnext( ) ring of "this"
- * with the same given geometrical information.
- * @param faceGeom Looks at most maxSize edges in the Lnext( ) ring.
- * @return Returns true on success. False otherwise.
- */
- void SetLnextRingGeometry( const D& v );
- void UnsetLnextRingGeometry( );
-
- /// Topological queries
- inline bool IsIsolated( ) const
- { return( this == this->m_Onext ); }
- bool IsEdgeInOnextRing( const TPrimal* e ) const;
- bool IsEdgeInLnextRing( const TPrimal* e ) const;
- unsigned int GetOnextRingSize( ) const;
- unsigned int GetLnextRingSize( ) const;
-
- /**
- * @return Returns true when "this" has no faces set on both sides.
- * Return false otherwise.
- */
- inline bool IsWire( )
- { return( !( this->IsLeftSet( ) ) && !( this->IsRightSet( ) ) ); }
-
- /**
- * @return Returns true when "this" is on the boundary i.e.
- * one and only one of the faces is set. Return false
- * otherwise.
- */
- inline bool IsAtBorder( ) const;
-
- /**
- * @return Returns true when "this" has faces set on both sides.
- * Return false otherwise.
- */
- inline bool IsInternal( ) const
- { return ( this->IsLeftSet( ) && this->IsRightSet( ) ); }
-
- /// Geometrical queries
- inline bool IsOriginSet( ) const
- { return ( this->m_Origin != Self::NoGeometry ); }
- inline bool IsDestinationSet( ) const
- { return ( this->m_Rot->m_Rot->IsOriginSet( ) ); }
- inline bool IsRightSet( ) const
- { return ( this->m_Rot->IsOriginSet( ) ); }
- inline bool IsLeftSet( ) const
- { return ( this->m_Rot->m_Rot->m_Rot->IsOriginSet( ) ); }
-
- /**
- * \brief Check wether edge's Origin is internal to the mesh (as
- * opposed to being on the boundary) by looking if all the edges
- * in the Onext() ring have a face set on both their Left() and
- * Right() side.
- */
- bool IsOriginInternal( ) const;
-
- /**
- * Definition: an edge is said to be a boundary edge when it is
- * adjacent to i.e. when at least one of the faces edge->GetLeft() or
- * edge->GetRight() is unset. Definition: an point is said to be a
- * boundary point when at least one of the edges of it's Onext() ring
- * is a boundary edge.
- *
- * Assume "this" edge belongs to a triangulation (i.e. it belongs to a
- * QEMesh which represents a 2-manifold) which possesses a boundary.
- * Assume "this" edge instance is a boundary edge. Let us denote by P
- * the point which is the origin of "this" edge i.e. P is
- * this->Origin(). By definition P is a boundary point. Then AT
- * LEAST two [see the note below] edges of the Onext() ring of P
- * [which all have the point P as Origin()] are themselves boundary
- * edges. And among those boundary edges AT LEAST one has it's Left()
- * face unset. By iterating over the Onext() ring (which defines a
- * local ordering on edges) this method searches for the first edge
- * whose Left() face is unset AND which is encountered AFTER edgeTest.
- *
- * @param edgeTest When present, this edge will be considered as
- * the entry edge in the Onext() ring. When absent it shall
- * be defaulted to "this" edge. (see the warning below).
- * @return When "this" edge is a boundary edge, return the first
- * edge in "this" Onext() ring whose Left() face is unset
- * AND located after edgeTest.
- * When "this" edge is NOT a boundary edge the 0 is
- * returned.
- * @warning When the Mesh possessing "this" edge is a 2-manifold
- * then result of this method is unique in the sense that
- * it is independent from the edgeTest parameter.
- * But when the Mesh is not 2-manifold (this state can
- * happen at intermediary stages of the building process,
- * or during "surgical" operations on the Mesh, and
- * even though the Mesh represents a triangulation)
- * the result of this method is not unique in the sense
- * that the result depends on the edgeTest parameter.
- * Let us illusatre this dependence by considering a
- * Mesh (which is a triangulation) which is not a 2-manifold.
- * Assume the point P (the origin of "this" edge i.e.
- * P = this->Originv()) is TWICE on the border i.e. it
- * is adjacent twice to noface. We can consider the situation
- * of the following diagram, which depicts some Onext()
- * ring around point P:
- *
- * \ / //
- * \ * / //
- * i3 b2 counter-clockwise //
- * * \ / NO FACE Onext() order. //
- * \ / //
- * ----b4-----P----b1------ //
- * /|\ //
- * NO FACE / | \ //
- * / | \ * <------ a * indicates the //
- * / | \ the presence of a face //
- * / | \ //
- * b5 i6 i7 //
- * / * | * \ //
- * / | \ //
- *
- * On this example, and if we assume the Onext() oder is
- * represented counter-clockwise, the edges are ordered as
- * follows:
- * b1, b2, i3, b4, b5, i6, i7
- * (when arbitrarily starting at edge b1).
- * We have four Boundary edges labeled b1, b2, b4, b5 and
- * we have three internal edges (i.e. non boundary edges)
- * labeled i3, i6 and i7.
- * Depending on edgeTest, the result of this method
- * will NOT return the same edge:
- * - when edgeTest == b5 (or i6 or i7 or b1) then the edge
- * b1 will be returned,
- * - when edgeTest == b2 (or i3 or b4) then the edge
- * b4 will be returned,
- * Eventually, when edgeTest is absent, the result shall
- * depend on the position of "this" in the Onext() ring().
- *
- */
- TPrimal* GetNextBorderEdgeWithUnsetLeft( TPrimal* edge = NULL ) const;
-
- /**
- * Assume "this->Originv()" is a boundary point P that is thrice adjacent
- * to noface and consider the given situation is the one depicted by
- * the following diagram where:
- * - P is "this->Originv()" instance,
- * - the * (star) indicates the presence of a face,
- * - b1, b2, b3, b4, b5, b6 denote boundary edges,
- * - p denotes some generic point,
- * - A and B denote some specific points we want to discuss,
- * - the Onext() ring order is represented counter-clockwise
- * [which is coherent with the definition of edge->GetRigth()]
- * i.e. the ordering of the edges is:
- * b1, b2, b3, b4, b5, b6, b1...
- *
- * p N p
- * / \ O / \ //
- * / \ / \ //
- * / \ F / \ counter-clockwise //
- * / b3 A b2 \ Onext() ring order //
- * / \ C / \ //
- * / * \ E / * \ //
- * / \ / \ //
- * A------b4------P------b1-------B //
- * / \ //
- * / \ //
- * NO FACE / \ NO FACE //
- * / \ //
- * b5 b6 //
- * / * \ //
- * / \ //
- * p---------------p //
- *
- * At P this Mesh doesn't represent a 2-manifold (since we are thrice
- * on the boundary). Nevertheless such a situation could arise in
- * intermediary stages (e.g. when building the Mesh, or during
- * surgical changes on the Mesh).
- * Now, assume we are asked to build the triangle [P, A, B]. Note
- * that this request is not absurd since the current situation at
- * P isn't the one of a 2-manifold: hence when building the current
- * Onext() ring of P, we had not enough information to decide
- * wheter b4.Onext() should be b5 or b1. It is ONLY when we are
- * required to build the triangle [P, A, B] that we have the
- * additional information that b4.Onext() is indeed b1.
- * When we are required to build triangle [P, A, B], we hence
- * need to change the Onext() ring order at P, i.e. we need to deal
- * with the triangle [P, b5, b6] which currently prevents
- * b4.Onext() to be b1. In other terms, when considering the
- * additional information that b4.Onext() is b1, and before
- * building the triangle [P, A, B], we need to reorder
- * the Onext() ring of P from it's current state
- * b1, b2, b3, b4, b5, b6, b1...
- * to an order coherent with the [P, A, B] request, i.e.
- * b1, b2, b5, b6, b3, b4, b1...
- *
- * In order to establish the "proper" Onext() ring at P we use
- * two Splice operations. The algorithm goes:
- * - first disconnect the piece of the surface containing the edge
- * [PB] (it would be the same process if we chose [PA]) from
- * the Onext() ring at P.
- * - second, re-integrate the disconnected piece at the desired
- * location i.e. side by side with [PA] (respectively [PB] if
- * we chose [PA] at first stage).
- * By "piece of surface containing the edge [PB]" we mean [all]
- * the triangle[s] starting at [PB] in the Onext() order and
- * having a left face set.
- *
- * We can illustrate this process on bit more general diagram than
- * the last case (where the "piece of surface containing the edge
- * [PB]" is constituted by two triangles) and when using
- * the arguments of this method (i.e. [PA] = this and [PB] = second).
- * The initial stage is the following (we note first=this=[PA] and
- * second=[PB]) where the Onext() ring order is:
- * first, b2, b3, second, b5, bsplice, b7, first...
- *
- * p N A //
- * / \ O / \ //
- * / \ / \ //
- * / \ F / \ counter-clockwise //
- * / b2 A first \ Onext() ring order //
- * / \ C / \ //
- * / * \ E / * \ //
- * / \ / \ //
- * p-------b3------P------b7-------p //
- * /|\ //
- * / | \ //
- * NO FACE / | \ NO FACE //
- * / | \ //
- * second b5 bsplice //
- * / * | * \ //
- * / | \ //
- * B-------p-------p //
- *
- * The first stage, implemented as
- * second->Oprev()->Splice( bsplice ),
- * yields the following diagram:
- *
- * p N A //
- * / \ O / \ //
- * / \ F / \ //
- * / \ A / \ counter-clockwise //
- * / b2 C first \ Onext() ring order //
- * / \ E / \ //
- * / * \ / * \ //
- * / \ / \ //
- * p-------b3------P------b7-------p //
- * //
- * NO FACE //
- * //
- * /|\ //
- * / | \ //
- * / | \ //
- * / | \ //
- * second b5 bsplice //
- * / * | * \ //
- * / | \ //
- * B-------p-------p //
- *
- * and the second stage, implemented as
- * first->Splice( bsplice ),
- * yields the following diagram:
- *
- * A //
- * B__ NO FACE / \ //
- * | \__ / \ //
- * | \__ / \ counter- //
- * | second first \ clockwise for all //
- * | \__ / \ //
- * | * \__ / * \ //
- * | \ / \ //
- * p-------b5---------P------b7-------p //
- * | __/|\ //
- * | * __/ | \ //
- * | / | \ NO FACE //
- * | bsplice | \ //
- * | __/ b2 b3 //
- * p__/ | * \ //
- * NO FACE | \ //
- * p-------p //
- *
- */
- inline static bool ReorderOnextRing( TPrimal* first, TPrimal* second );
-
- /**
- * \brief Basic quad-edge topological method.
- *
- * This method describes all possible topological operations on an
- * edge since it is its own inverse. It works in two ways:
- *
- * 1. If this->m_Org != b->m_Org, it slice a face in two.
- * 2. If this->m_Org == b->m_Org, it unifies two faces.
- */
- inline static void Splice( TPrimal* a, TPrimal* b );
-
- protected:
- QuadEdge( );
- virtual ~QuadEdge( );
-
- public:
- static const TPrimalGeometry NoGeometry;
-
- protected:
- Pointer m_Onext; /**< Onext ring */
- PtrDual m_Rot; /**< Rot ring */
- TPrimalGeometry m_Origin; /**< Geometry attached to edge's origin */
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/QuadEdge.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGE__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGECELL__H__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGECELL__H__
-
-#include <vector>
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< class I, class E >
- class QuadEdgeCell
- : public I
- {
- public:
- // Base types
- typedef QuadEdgeCell Self;
- typedef I Superclass;
- typedef itk::AutoPointer< Self > SelfAutoPointer;
- typedef itk::AutoPointer< const Self > ConstSelfAutoPointer;
- typedef Self* RawPointer;
- typedef const Self* ConstRawPointer;
-
- // QuadEdge objects
- typedef E TPrimalEdge;
- typedef typename E::TDual TDualEdge;
-
- // Inherited types
- typedef typename I::PixelType PixelType;
- typedef typename I::CellType CellType;
- typedef typename I::CellAutoPointer CellAutoPointer;
- typedef typename I::CellConstAutoPointer CellConstAutoPointer;
- typedef typename I::CellRawPointer CellRawPointer;
- typedef typename I::CellConstRawPointer CellConstRawPointer;
- typedef typename I::CellTraits CellTraits;
- typedef typename I::CoordRepType CoordRepType;
- typedef typename I::InterpolationWeightType InterpolationWeightType;
- typedef typename I::PointIdentifier PointIdentifier;
- typedef typename I::PointIdIterator PointIdIterator;
- typedef typename I::PointIdConstIterator PointIdConstIterator;
- typedef typename I::CellIdentifier CellIdentifier;
- typedef typename I::CellFeatureIdentifier CellFeatureIdentifier;
- typedef typename I::CellFeatureIdentifier CellFeatureCount;
- typedef typename I::PointType PointType;
- typedef typename I::VectorType VectorType;
- typedef typename I::PointsContainer PointsContainer;
- typedef typename I::UsingCellsContainer UsingCellsContainer;
- typedef typename I::CellGeometry CellGeometry;
- typedef typename I::ParametricCoordArrayType ParametricCoordArrayType;
- typedef typename I::ShapeFunctionsArrayType ShapeFunctionsArrayType;
-
- itkStaticConstMacro( PointDimension, unsigned int, I::PointDimension );
- itkStaticConstMacro( CellDimension, unsigned int, 2 );
-
- public:
- itkTypeMacro( QuadEdgeCell, I );
-
- public:
- QuadEdgeCell( );
- QuadEdgeCell( E* entry );
- virtual ~QuadEdgeCell( );
-
- /// Implement the standard CellInterface.
- virtual CellGeometry GetType( ) const;
- virtual void MakeCopy( CellAutoPointer& other ) const;
- virtual unsigned int GetDimension( ) const;
- virtual unsigned int GetNumberOfPoints( ) const;
- virtual CellFeatureCount GetNumberOfBoundaryFeatures(
- int dimension
- ) const;
- virtual bool GetBoundaryFeature(
- int dimension, CellFeatureIdentifier fId, CellAutoPointer& ptr
- );
- virtual void SetPointIds( PointIdConstIterator first );
- virtual void SetPointIds(
- PointIdConstIterator first, PointIdConstIterator last
- );
- virtual void AddPointId( PointIdentifier pId );
- virtual void RemovePointId( PointIdentifier pId );
- virtual void SetPointIds(
- int dummy, int num, PointIdConstIterator first
- );
- virtual void BuildEdges( );
- virtual void ClearPoints( );
- virtual void SetPointId( int localId, PointIdentifier pId );
-
- // Visitor methods
- static int GetTopologyId( );
- virtual void Accept(
- CellIdentifier cellid,
- typename itk::CellInterface< PixelType, CellTraits >::
- MultiVisitor* mv
- );
-
- // Iterators
- virtual PointIdIterator PointIdsBegin( );
- virtual PointIdConstIterator PointIdsBegin( ) const;
- virtual PointIdIterator PointIdsEnd( );
- virtual PointIdConstIterator PointIdsEnd( ) const;
-
- /// QuadEdgeCell-specific interface.
- virtual E* GetEntryPrimalEdge( );
- virtual const E* GetEntryPrimalEdge( ) const;
- virtual void SetEntryPrimalEdge( E* entry );
-
- private:
- /// Purposely not implemented.
- QuadEdgeCell( const Self& );
- Self& operator=( const Self& );
-
- protected:
- E* m_EntryEdge;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/QuadEdgeCell.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGECELL__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGEITERATORS__H__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGEITERATORS__H__
-
-#include <cstdlib>
-
-// -------------------------------------------------------------------------
-#define cpPluginsExtensionsQEIteratorsMacro( op, it, cit ) \
- inline it Begin##op( ) \
- { return( it( this, it::Op##op, true ) ); } \
- inline it End##op( ) \
- { return( it( this, it::Op##op, false ) ); } \
- inline cit Begin##op( ) const \
- { return( cit( this, cit::Op##op, true ) ); } \
- inline cit End##op( ) const \
- { return( cit( this, cit::Op##op, false ) ); }
-
-// -------------------------------------------------------------------------
-#define cpPluginsExtensionsQEPointIteratorsMacro( op, it, cit ) \
- inline Point##it BeginPoint##op( ) \
- { return( Point##it( this, it::Op##op, true ) ); } \
- inline Point##it EndPoint##op( ) \
- { return( Point##it( this, it::Op##op, false ) ); } \
- inline Point##cit BeginPoint##op( ) const \
- { return( Point##cit( this, cit::Op##op, true ) ); } \
- inline Point##cit EndPoint ##op( ) const \
- { return( Point##cit( this, cit::Op##op, false ) ); }
-
-// -------------------------------------------------------------------------
-#define cpPluginsExtensionsQEAllIteratorsMacro( op ) \
- cpPluginsExtensionsQEIteratorsMacro( op, Iterator, ConstIterator ); \
- cpPluginsExtensionsQEPointIteratorsMacro( op, Iterator, ConstIterator );
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< class E >
- class QuadEdgeBaseIterator
- {
- public:
- typedef QuadEdgeBaseIterator Self;
- typedef E TQuadEdge;
-
- // Different types of logical iterators
- enum
- {
- OpOnext = 0,
- OpLnext = 1,
- OpRnext = 2,
- OpDnext = 3,
- OpOprev = 4,
- OpLprev = 5,
- OpRprev = 6,
- OpDprev = 7
- };
-
- public:
- QuadEdgeBaseIterator( E* e, int op = OpOnext, bool start = true );
- virtual ~QuadEdgeBaseIterator( );
- Self& operator=( const Self& r );
-
- E* GetStartEdge( ) const;
- E* GetIterator( ) const;
- int GetOpType( ) const;
- bool GetStart( ) const;
-
- bool operator==( Self& r );
- bool operator==( const Self& r ) const;
- bool operator!=( Self& r );
- bool operator!=( const Self& r ) const;
- Self& operator++( );
- Self& operator++( int );
-
- protected:
- /// Method that should do all the iteration work
- virtual void _GoToNext( );
-
- protected:
- E* m_StartEdge; /**< Start edge */
- E* m_Iterator; /**< Current iteration position */
- int m_OpType; /**< Operation type */
- bool m_Start; /**< Indicates iteration has just started */
- };
-
- /**
- */
- template< class E >
- class QuadEdgeIterator
- : public QuadEdgeBaseIterator< E >
- {
- public:
- typedef QuadEdgeIterator Self;
- typedef QuadEdgeBaseIterator< E > Superclass;
- typedef E TQuadEdge;
-
- public:
- QuadEdgeIterator(
- E* e = NULL, int op = Superclass::OpOnext, bool start = true
- );
- virtual ~QuadEdgeIterator( );
- E* operator*( );
- };
-
- /**
- */
- template< class E >
- class QuadEdgeConstIterator
- : public QuadEdgeBaseIterator< const E >
- {
- public:
- typedef QuadEdgeConstIterator Self;
- typedef QuadEdgeBaseIterator< const E > Superclass;
- typedef E TQuadEdge;
-
- public:
- QuadEdgeConstIterator(
- const E* e = NULL, int op = Superclass::OpOnext, bool start = true
- );
- virtual ~QuadEdgeConstIterator( );
- const E* operator*( ) const;
- };
-
- /**
- */
- template< class E >
- class QuadEdgePointIterator
- : public QuadEdgeBaseIterator< const E >
- {
- public:
- typedef QuadEdgePointIterator Self;
- typedef QuadEdgeBaseIterator< const E > Superclass;
- typedef E TQuadEdge;
-
- public:
- QuadEdgePointIterator(
- const E* e = NULL, int op = Superclass::OpOnext, bool start = true
- );
- virtual ~QuadEdgePointIterator( );
- typename E::TPrimalGeometry& operator*( );
- };
-
- /**
- */
- template< class E >
- class QuadEdgePointConstIterator
- : public QuadEdgeBaseIterator< const E >
- {
- public:
- typedef QuadEdgePointConstIterator Self;
- typedef QuadEdgeBaseIterator< const E > Superclass;
- typedef E TQuadEdge;
-
- public:
- QuadEdgePointConstIterator(
- const E* e = NULL, int op = Superclass::OpOnext, bool start = true
- );
- virtual ~QuadEdgePointConstIterator( );
- const typename E::TPrimalGeometry& operator*( ) const;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/QuadEdgeIterators.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGEITERATORS__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__QUADEDGEMESH__H__
-#define __CPPLUGINS__EXTENSIONS__QUADEDGEMESH__H__
-
-#include <set>
-#include <vector>
-
-#include <itkMesh.h>
-#include <cpPlugins/Extensions/QuadEdgeCell.h>
-#include <cpPlugins/Extensions/QuadEdge.h>
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- */
- template< typename P, unsigned int D = 3, typename T = itk::DefaultStaticMeshTraits< P, D, D > >
- class QuadEdgeMesh
- : public itk::Mesh< P, D, T >
- {
- public:
- typedef QuadEdgeMesh Self;
- typedef itk::Mesh< P, D, T > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- /// Types from superclass
- typedef typename
- Superclass::BoundaryAssignmentsContainer
- BoundaryAssignmentsContainer;
-
- typedef typename
- Superclass::BoundaryAssignmentsContainerPointer
- BoundaryAssignmentsContainerPointer;
-
- typedef typename Superclass::BoundingBoxType BoundingBoxType;
- typedef typename Superclass::CellAutoPointer CellAutoPointer;
- typedef typename Superclass::CellsContainer CellsContainer;
- typedef typename Superclass::CellDataContainer CellDataContainer;
- typedef typename Superclass::CellFeatureCount CellFeatureCount;
- typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
- typedef typename Superclass::CellIdentifier CellIdentifier;
- typedef typename Superclass::CellLinksContainer CellLinksContainer;
- typedef typename Superclass::CellMultiVisitorType CellMultiVisitorType;
- typedef typename Superclass::CellPixelType CellPixelType;
- typedef typename Superclass::CellType CellType;
- typedef typename Superclass::PointIdentifier PointIdentifier;
- typedef typename Superclass::PointsContainer PointsContainer;
- typedef typename Superclass::PointType PointType;
-
- /// QuadEdge types (primal and dual)
- typedef QuadEdge< PointIdentifier, CellIdentifier > TPrimalEdge;
- typedef typename TPrimalEdge::TDual TDualEdge;
- typedef QuadEdgeCell< CellType, TPrimalEdge > TQuadEdgeCell;
-
- /// Memory management objects
- typedef std::set< typename TPrimalEdge::Pointer > CntPrimalEdges;
- typedef std::set< typename TDualEdge::Pointer > CntDualEdges;
- typedef std::vector< TPrimalEdge* > CntOnextRings;
-
- /// More geometry types
- typedef typename PointType::VectorType VectorType;
- typedef typename VectorType::ValueType TScalar;
- typedef std::vector< VectorType > CntNormals;
- typedef typename CntNormals::const_iterator NormalsIterator;
-
- protected:
- typedef std::vector< TPrimalEdge* > _TEdges;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( QuadEdgeMesh, itkMesh );
-
- public:
- // Edge related methods
- TPrimalEdge* FindEdge( const PointIdentifier& a ) const;
- TPrimalEdge* FindEdge(
- const PointIdentifier& a, const PointIdentifier& b
- ) const;
- TPrimalEdge* FindEntryEdge( const CellIdentifier& i ) const;
-
- /// New geometric methods
- const CntNormals& GetPointNormalsContainer( ) const;
- NormalsIterator BeginPointNormals( ) const;
- NormalsIterator EndPointNormals( ) const;
- const VectorType& GetPointNormal( const PointIdentifier& id ) const;
-
- /// itk::DataObject methods overloading
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
-
- /// itk::PointSet methods overloading
- virtual void SetPoints( PointsContainer* points );
- virtual void SetPoint( PointIdentifier id , PointType point );
-
- /// itk::Mesh methods overloading
- virtual void PassStructure( Self* inputMesh )
- {
- std::cout << "PassStructure" << std::endl;
- std::exit( 1 );
- }
-
- virtual void Initialize( );
- virtual void Graft( const itk::DataObject* data );
-
- void SetCellLinks( CellLinksContainer* cellLinks )
- {
- std::cout << "SetCellLinks" << std::endl;
- std::exit( 1 );
- }
- virtual CellLinksContainer* GetCellLinks( )
- {
- std::cout << "GetCellLinks" << std::endl;
- std::exit( 1 );
- }
- virtual const CellLinksContainer* GetCellLinks( ) const
- {
- std::cout << "GetCellLinks (const)" << std::endl;
- std::exit( 1 );
- }
- virtual void SetCells( CellsContainer* cells );
- virtual void SetCellData( CellDataContainer* data );
- virtual CellDataContainer* GetCellData( )
- {
- std::cout << "GetCellData" << std::endl;
- std::exit( 1 );
- }
- virtual const CellDataContainer* GetCellData( ) const
- {
- std::cout << "GetCellData (const)" << std::endl;
- std::exit( 1 );
- }
-
-#if !defined( CABLE_CONFIGURATION )
- virtual void SetBoundaryAssignments(
- int dimension, BoundaryAssignmentsContainer* container
- )
- {
- std::cout << "SetBoundaryAssignments" << std::endl;
- std::exit( 1 );
- }
- virtual BoundaryAssignmentsContainerPointer
- GetBoundaryAssignments( int dimension )
- {
- std::cout << "GetBoundaryAssignments" << std::endl;
- std::exit( 1 );
- }
- virtual const BoundaryAssignmentsContainerPointer
- GetBoundaryAssignments( int dimension ) const
- {
- std::cout << "GetBoundaryAssignments (const)" << std::endl;
- std::exit( 1 );
- }
-#endif
-
- virtual void SetCell( CellIdentifier id, CellAutoPointer& ptr );
- virtual void SetCellData( CellIdentifier id, CellPixelType data );
- virtual bool GetCellData( CellIdentifier id, CellPixelType* data ) const
- {
- std::cout << "GetCellData" << std::endl;
- std::exit( 1 );
- }
- virtual void SetBoundaryAssignment(
- int dimension, CellIdentifier cellId,
- CellFeatureIdentifier featureId,
- CellIdentifier boundaryId
- )
- {
- std::cout << "SetBoundaryAssignment" << std::endl;
- std::exit( 1 );
- }
- virtual bool GetBoundaryAssignment(
- int dimension, CellIdentifier cellId,
- CellFeatureIdentifier featureId,
- CellIdentifier* boundaryId
- ) const
- {
- std::cout << "GetBoundaryAssignment" << std::endl;
- std::exit( 1 );
- }
- virtual bool RemoveBoundaryAssignment(
- int dimension, CellIdentifier cellId,
- CellFeatureIdentifier featureId
- )
- {
- std::cout << "RemoveBoundaryAssignment" << std::endl;
- std::exit( 1 );
- }
- virtual CellFeatureCount GetNumberOfCellBoundaryFeatures(
- int dimension,
- CellIdentifier id
- ) const
- {
- std::cout << "GetNumberOfCellBoundaryFeatures" << std::endl;
- std::exit( 1 );
- }
- virtual bool GetCellBoundaryFeature(
- int dimension, CellIdentifier id,
- CellFeatureIdentifier fid,
- CellAutoPointer& ptr
- ) const
- {
- std::cout << "GetCellBoundaryFeature" << std::endl;
- std::exit( 1 );
- }
- virtual CellIdentifier GetCellBoundaryFeatureNeighbors(
- int dimension,
- CellIdentifier id,
- CellFeatureIdentifier fid,
- std::set< CellIdentifier >* cellSet )
- {
- std::cout << "GetCellBoundaryFeatureNeighbors" << std::endl;
- std::exit( 1 );
- }
- virtual CellIdentifier GetCellNeighbors(
- CellIdentifier cellId,
- std::set< CellIdentifier >* cellSet
- )
- {
- std::cout << "GetCellNeighbors" << std::endl;
- std::exit( 1 );
- }
- virtual bool GetAssignedCellBoundaryIfOneExists(
- int dimension, CellIdentifier id,
- CellFeatureIdentifier fid,
- CellAutoPointer& ptr
- ) const
- {
- std::cout << "GetAssignedCellBoundaryIfOneExists" << std::endl;
- std::exit( 1 );
- }
- virtual void BuildCellLinks( ) const;
-
- virtual void Accept( CellMultiVisitorType* mv ) const
- {
- std::cout << "Accept" << std::endl;
- std::exit( 1 );
- }
-
- protected:
- QuadEdgeMesh( );
- virtual ~QuadEdgeMesh( );
-
- virtual void ReleaseCellsMemory( )
- {
- std::cout << "ReleaseCellsMemory" << std::endl;
- std::exit( 1 );
- }
-
- inline bool _CheckPoints( const CellAutoPointer& ptr ) const;
- inline void _DeletePoint( const PointIdentifier& pId );
- inline TPrimalEdge* _CreateQuadEdge(
- const PointIdentifier& a, const PointIdentifier& b
- );
- inline void _DeleteEdge( TPrimalEdge* edge );
- inline void _DeleteFace( const CellIdentifier& f );
- inline void _ConstructEdges(
- _TEdges& edges, const CellAutoPointer& ptr
- );
- virtual VectorType _ComputePointNormal( const TPrimalEdge* e ) const;
- inline void _ReleaseQuadEdgeObjects( );
-
- private:
- QuadEdgeMesh( const Self& ); // Not implemented
- void operator=( const Self& ); // Not implemented
-
- protected:
- CntPrimalEdges m_PrimalEdges;
- CntDualEdges m_DualEdges;
-
- CntOnextRings m_OnextRings;
-
- CntNormals m_PointNormals;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/QuadEdgeMesh.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__QUADEDGEMESH__H__
-
-// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__H__
+#define __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__H__
+
+#include <itkConceptChecking.h>
+#include <vtkMapper.h>
+
+class vtkActor;
+class vtkInformation;
+class vtkRenderer;
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace Visualization
+ {
+ /**
+ */
+ template< class M >
+ class MeshMapper
+ : public vtkMapper
+ {
+ public:
+ typedef MeshMapper Self;
+ vtkTypeMacro( MeshMapper, vtkMapper );
+
+ typedef M TMesh;
+ typedef typename M::PointType TPoint;
+ typedef typename TPoint::VectorType TVector;
+ typedef typename TPoint::CoordRepType TScalar;
+ itkStaticConstMacro( Dimension, unsigned int, M::PointDimension );
+
+ // Begin concept checking
+#ifdef ITK_USE_CONCEPT_CHECKING
+ /* TODO
+ itkConceptMacro(
+ InputMeshIsTwoOrThreeimensionalCheck,
+ ( itk::Concept::SameDimensionOrMinusOne< Self::Dimension, 3 > )
+ );
+ itkConceptMacro(
+ ScalarTypeHasFloatResolution,
+ ( itk::Concept::IsFloatingPoint< TScalar > )
+ );
+ */
+#endif
+ // End concept checking
+
+ public:
+ // TODO: static Self* New( );
+ virtual void ShallowCopy( vtkAbstractMapper* m );
+
+ virtual void SetInputData( M* in );
+ virtual M* GetInput( );
+ virtual const M* GetInput( ) const;
+
+ virtual double* GetBounds( );
+ virtual void GetBounds( double bounds[ 6 ] );
+
+ virtual void RenderPiece( vtkRenderer* aren, vtkActor* act ) = 0;
+ virtual void Render( vtkRenderer* aren, vtkActor* act );
+ virtual void Update( );
+ virtual void Update( int port );
+
+ virtual void MapDataArrayToVertexAttribute(
+ const char* vertexAttributeName,
+ const char* dataArrayName,
+ int fieldAssociation,
+ int componentno = -1
+ );
+ virtual void MapDataArrayToMultiTextureAttribute(
+ int unit,
+ const char* dataArrayName,
+ int fieldAssociation,
+ int componentno = -1
+ );
+ virtual void RemoveVertexAttributeMapping(
+ const char* vertexAttributeName
+ );
+ virtual void RemoveAllVertexAttributeMappings( );
+
+ protected:
+ MeshMapper( );
+ virtual ~MeshMapper( );
+
+ virtual void ComputeBounds( );
+ virtual int FillInputPortInformation( int port, vtkInformation* info );
+
+ private:
+ // These methods aren't supposed to be implemented
+ MeshMapper( const Self& other );
+ Self& operator=( const Self& other );
+
+ protected:
+ typename M::Pointer Mesh;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/Visualization/MeshMapper.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__MESHMAPPER__HXX__
-#define __CPPLUGINS__EXTENSIONS__MESHMAPPER__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__HXX__
+#define __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__HXX__
#include <vtkInformation.h>
#include <vtkMath.h>
-// TODO: #include <cpPlugins/Extensions/OpenGLMeshMapper.h>
+// TODO: #include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
// -------------------------------------------------------------------------
/* TODO
template< class M >
- typename cpPlugins::Extensions::MeshMapper< M >::
- Self* cpPlugins::Extensions::MeshMapper< M >::
+ typename cpPlugins::Extensions::Visualization::MeshMapper< M >::
+ Self* cpPlugins::Extensions::Visualization::MeshMapper< M >::
New( )
{
- return( cpPlugins::Extensions::OpenGLMeshMapper< M >::New( ) );
+ return(
+ cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::New( )
+ );
}
*/
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
ShallowCopy( vtkAbstractMapper* m )
{
Self* mapper = Self::SafeDownCast( m );
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
SetInputData( M* in )
{
if( this->Mesh != in )
// -------------------------------------------------------------------------
template< class M >
-M* cpPlugins::Extensions::MeshMapper< M >::
+M* cpPlugins::Extensions::Visualization::MeshMapper< M >::
GetInput( )
{
return( this->Mesh );
// -------------------------------------------------------------------------
template< class M >
-const M* cpPlugins::Extensions::MeshMapper< M >::
+const M* cpPlugins::Extensions::Visualization::MeshMapper< M >::
GetInput( ) const
{
return( this->Mesh );
// -------------------------------------------------------------------------
template< class M >
-double* cpPlugins::Extensions::MeshMapper< M >::
+double* cpPlugins::Extensions::Visualization::MeshMapper< M >::
GetBounds( )
{
// do we have an input
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
GetBounds( double bounds[ 6 ] )
{
this->Superclass::GetBounds( bounds );
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
Render( vtkRenderer* aren, vtkActor* act )
{
if( this->Mesh.IsNull( ) )
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
Update( )
{
// TODO:
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
Update( int port )
{
// TODO:
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
MapDataArrayToVertexAttribute(
const char* vertexAttributeName,
const char* dataArrayName,
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
MapDataArrayToMultiTextureAttribute(
int unit,
const char* dataArrayName,
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
RemoveVertexAttributeMapping( const char* vertexAttributeName )
{
vtkErrorMacro( "Not implemented at this level..." );
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
RemoveAllVertexAttributeMappings( )
{
vtkErrorMacro( "Not implemented at this level..." );
// -------------------------------------------------------------------------
template< class M >
-cpPlugins::Extensions::MeshMapper< M >::
+cpPlugins::Extensions::Visualization::MeshMapper< M >::
MeshMapper( )
: Superclass( )
{
// -------------------------------------------------------------------------
template< class M >
-cpPlugins::Extensions::MeshMapper< M >::
+cpPlugins::Extensions::Visualization::MeshMapper< M >::
~MeshMapper( )
{
}
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::MeshMapper< M >::
+void cpPlugins::Extensions::Visualization::MeshMapper< M >::
ComputeBounds( )
{
static const TScalar _0 = TScalar( 0 );
// -------------------------------------------------------------------------
template< class M >
-int cpPlugins::Extensions::MeshMapper< M >::
+int cpPlugins::Extensions::Visualization::MeshMapper< M >::
FillInputPortInformation( int port, vtkInformation* info )
{
info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE( ), "itk::Mesh" );
return( 1 );
}
-#endif // __CPPLUGINS__EXTENSIONS__MESHMAPPER__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__HXX__
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
+#define __CPPLUGINS__EXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
+
+#include <vector>
+
+#include <cpPlugins/Extensions/Visualization/MeshMapper.h>
+
+namespace cpPlugins
+{
+ namespace Extensions
+ {
+ namespace Visualization
+ {
+ /**
+ */
+ template< class M >
+ class OpenGLMeshMapper
+ : public MeshMapper< M >
+ {
+ public:
+ typedef OpenGLMeshMapper Self;
+ vtkTypeMacro( OpenGLMeshMapper, MeshMapper< M > );
+
+ typedef typename Superclass::TMesh TMesh;
+ typedef typename Superclass::TPoint TPoint;
+ typedef typename Superclass::TVector TVector;
+ typedef typename Superclass::TScalar TScalar;
+
+ protected:
+ typedef unsigned int TIndex;
+ typedef typename M::CellType TCell;
+ typedef typename M::CellsContainer TCellsContainer;
+ typedef typename TCellsContainer::ConstIterator TCellIt;
+
+ public:
+ virtual const char* GetNameOfClass( ) const
+ { return( "cpPlugins::Extensions::OpenGLMeshMapper" ); }
+ static Self* New( );
+
+ virtual void RenderPiece( vtkRenderer* aren, vtkActor* act );
+ virtual void ReleaseGraphicsResources( vtkWindow* win );
+ virtual int Draw( vtkRenderer* aren, vtkActor* act );
+
+ protected:
+ OpenGLMeshMapper( );
+ virtual ~OpenGLMeshMapper( );
+
+ bool _ConfigureOpenGL( );
+
+ private:
+ // Purposely not implemented
+ OpenGLMeshMapper( const Self& other );
+ Self& operator=( const Self& other );
+
+ protected:
+ vtkIdType TotalCells;
+ // TODO: vtkSmartPointer< vtkOpenGLTexture > InternalColorTexture;
+
+ bool FirstRendering;
+
+ bool VBOSupported;
+ unsigned int VBOID1, VBOID2;
+
+ std::vector< unsigned int > Sizes;
+ std::vector< TIndex > Indices;
+ long IndexElementType;
+ long ElementValueType;
+ };
+
+ } // ecapseman
+
+ } // ecapseman
+
+} // ecapseman
+
+#include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx>
+
+#endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__H__
+
+// eof - $RCSfile$
-#ifndef __CPPLUGINS__EXTENSIONS__OPENGLMESHMAPPER__HXX__
-#define __CPPLUGINS__EXTENSIONS__OPENGLMESHMAPPER__HXX__
+#ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__HXX__
+#define __CPPLUGINS__EXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__HXX__
#include <algorithm>
#include <string>
// -------------------------------------------------------------------------
template< class M >
-typename cpPlugins::Extensions::OpenGLMeshMapper< M >::
-Self* cpPlugins::Extensions::OpenGLMeshMapper< M >::
+typename cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
+Self* cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
New( )
{
return( new Self( ) );
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::OpenGLMeshMapper< M >::
+void cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
RenderPiece( vtkRenderer* aren, vtkActor* act )
{
vtkOpenGLClearErrorMacro( );
// -------------------------------------------------------------------------
template< class M >
-void cpPlugins::Extensions::OpenGLMeshMapper< M >::
+void cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
ReleaseGraphicsResources( vtkWindow* win )
{
if( win && win->GetMapped( ) )
// -------------------------------------------------------------------------
template< class M >
-int cpPlugins::Extensions::OpenGLMeshMapper< M >::
+int cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
Draw( vtkRenderer* aren, vtkActor* act )
{
vtkOpenGLClearErrorMacro( );
// -------------------------------------------------------------------------
template< class M >
-cpPlugins::Extensions::OpenGLMeshMapper< M >::
+cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
OpenGLMeshMapper( )
: Superclass( ),
TotalCells( 0 ),
// -------------------------------------------------------------------------
template< class M >
-cpPlugins::Extensions::OpenGLMeshMapper< M >::
+cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
~OpenGLMeshMapper( )
{
if( this->LastWindow )
// -------------------------------------------------------------------------
template< class M >
-bool cpPlugins::Extensions::OpenGLMeshMapper< M >::
+bool cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::
_ConfigureOpenGL( )
{
M* input = this->GetInput( );
return( true );
}
-#endif // __CPPLUGINS__EXTENSIONS__OPENGLMESHMAPPER__HXX__
+#endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__OPENGLMESHMAPPER__HXX__
// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__EXTENSIONS__WAVEFRONTOBJREADER__H__
-#define __CPPLUGINS__EXTENSIONS__WAVEFRONTOBJREADER__H__
-
-#include <string>
-#include <itkIntTypes.h>
-#include <itkMesh.h>
-#include <itkMeshSource.h>
-#include <itkPolygonCell.h>
-
-namespace cpPlugins
-{
- namespace Extensions
- {
- /**
- * \class WaveFrontOBJReader
- * \brief
- * Reads a wavefront OBJ file and create an itkMesh.
- *
- * Caveat1: itkWaveFrontOBJReader will read only vertices and faces.
- * Normal, parameters and textures vectors are ignored.
- *
- */
- template< typename M >
- class WaveFrontOBJReader
- : public itk::MeshSource< M >
- {
- public:
- typedef WaveFrontOBJReader Self;
- typedef itk::MeshSource< M > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- typedef M MeshType;
- typedef typename M::MeshTraits MeshTraits;
- typedef typename M::PointType PointType;
- typedef typename MeshTraits::PixelType PixelType;
- typedef typename M::Pointer MeshPointer;
- typedef typename M::CellTraits CellTraits;
- typedef typename M::CellIdentifier CellIdentifier;
- typedef typename M::CellType CellType;
- typedef typename M::CellAutoPointer CellAutoPointer;
- typedef typename M::PointIdentifier PointIdentifier;
- typedef typename CellTraits::PointIdIterator PointIdIterator;
- typedef typename M::PointsContainerPointer PointsContainerPointer;
- typedef typename M::PointsContainer PointsContainer;
-
- typedef itk::PolygonCell< CellType > TPolygonCell;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( WaveFrontOBJReader, itkMeshSource );
-
- itkSetStringMacro( FileName );
- itkGetStringMacro( FileName );
-
- protected:
- WaveFrontOBJReader( );
- virtual ~WaveFrontOBJReader( );
-
- virtual void GenerateData( );
-
- private:
- // Purposely not implemented
- WaveFrontOBJReader( const Self& );
- Self& operator=( const Self & );
-
- protected:
- std::string m_FileName;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#include <cpPlugins/Extensions/WaveFrontOBJReader.hxx>
-
-#endif // __CPPLUGINS__EXTENSIONS__WAVEFRONTOBJREADER__H__
-
-// eof - $RCSfile$
#include <vtkMapper.h>
-#include <cpPlugins/Extensions/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/OpenGLMeshMapper.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
+#include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
// -------------------------------------------------------------------------
cpPlugins::Interface::Mesh::
this->Superclass::SetDataObject( dobj );
// WARNING: Only 2 and 3 dimensions at this moment
- typedef cpPlugins::Extensions::QuadEdgeMesh< float, 2 > _TF2;
- typedef cpPlugins::Extensions::QuadEdgeMesh< double, 2 > _TD2;
- typedef cpPlugins::Extensions::QuadEdgeMesh< float, 3 > _TF3;
- typedef cpPlugins::Extensions::QuadEdgeMesh< double, 3 > _TD3;
+ using namespace cpPlugins::Extensions;
+ typedef DataStructures::QuadEdgeMesh< float, 2 > _TF2;
+ typedef DataStructures::QuadEdgeMesh< double, 2 > _TD2;
+ typedef DataStructures::QuadEdgeMesh< float, 3 > _TF3;
+ typedef DataStructures::QuadEdgeMesh< double, 3 > _TD3;
if ( dynamic_cast< _TF2* >( dobj ) ) this->_Map< _TF2 >( );
else if( dynamic_cast< _TD2* >( dobj ) ) this->_Map< _TD2 >( );
void cpPlugins::Interface::Mesh::
_Map( )
{
- typedef cpPlugins::Extensions::OpenGLMeshMapper< M > _TMapper;
+ typedef
+ cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >
+ _TMapper;
if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
M* mesh = dynamic_cast< M* >( this->Superclass::GetDataObject( ) );
#include <cpPlugins/Plugins/MeshReader.h>
#include <cpPlugins/Interface/Mesh.h>
-#include <cpPlugins/Extensions/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/MeshReader.h>
+#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
+#include <cpPlugins/Extensions/IO/MeshReader.h>
// -------------------------------------------------------------------------
cpPlugins::Plugins::MeshReader::
if( fIt == this->m_Parameters.end( ) )
fIt = this->m_DefaultParameters.find( "FileName" );
- typedef cpPlugins::Extensions::QuadEdgeMesh< P, D > _TMesh;
- typedef cpPlugins::Extensions::MeshReader< _TMesh > _TReader;
+ using namespace cpPlugins::Extensions;
+ typedef DataStructures::QuadEdgeMesh< P, D > _TMesh;
+ typedef IO::MeshReader< _TMesh > _TReader;
_TReader* reader =
dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) );