00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkTriangleCell_h
00018 #define __itkTriangleCell_h
00019
00020 #include "itkCellInterface.h"
00021 #include "itkLineCell.h"
00022 #include "itkTriangleCellTopology.h"
00023
00024 #include <vector>
00025
00026 namespace itk
00027 {
00028
00044 template < typename TCellInterface >
00045 class ITK_EXPORT TriangleCell:
00046 public TCellInterface, private TriangleCellTopology
00047 {
00048 public:
00050 itkCellCommonTypedefs(TriangleCell);
00051 itkCellInheritedTypedefs(TCellInterface);
00053
00055 itkTypeMacro(TriangleCell, CellInterface);
00056
00058 typedef VertexCell< TCellInterface > VertexType;
00059 typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
00060
00062 typedef LineCell< TCellInterface > EdgeType;
00063 typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
00064
00066 itkStaticConstMacro(NumberOfPoints, unsigned int, 3);
00067 itkStaticConstMacro(NumberOfVertices, unsigned int, 3);
00068 itkStaticConstMacro(NumberOfEdges, unsigned int, 3);
00069 itkStaticConstMacro(CellDimension, unsigned int, 2);
00071
00073 virtual CellGeometry GetType(void) const
00074 {return Superclass::TRIANGLE_CELL;}
00075 virtual void MakeCopy( CellAutoPointer & ) const;
00076 virtual unsigned int GetDimension(void) const;
00077 virtual unsigned int GetNumberOfPoints(void) const;
00078 virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
00079 virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier,
00080 CellAutoPointer &);
00081 virtual void SetPointIds(PointIdConstIterator first);
00082 virtual void SetPointIds(PointIdConstIterator first,
00083 PointIdConstIterator last);
00084 virtual void SetPointId(int localId, PointIdentifier);
00085 virtual PointIdIterator PointIdsBegin(void);
00086 virtual PointIdConstIterator PointIdsBegin(void) const;
00087 virtual PointIdIterator PointIdsEnd(void);
00088 virtual PointIdConstIterator PointIdsEnd(void) const;
00090
00092 virtual CellFeatureCount GetNumberOfVertices(void) const;
00093 virtual CellFeatureCount GetNumberOfEdges(void) const;
00094 virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
00095 virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
00097
00098 virtual bool EvaluatePosition(CoordRepType*,
00099 PointsContainer* ,
00100 CoordRepType*,
00101 CoordRepType [],
00102 double *,
00103 InterpolationWeightType*);
00104
00106 itkCellVisitMacro(Superclass::TRIANGLE_CELL);
00107
00108
00110 CoordRepType ComputeArea( PointsContainer* );
00111 PointType ComputeBarycenter( CoordRepType*,
00112 PointsContainer* );
00113
00114 PointType ComputeCenterOfGravity( PointsContainer* );
00115 PointType ComputeCircumCenter( PointsContainer* );
00116
00117 public:
00118 TriangleCell() :
00119 m_PointIds( NumberOfPoints, NumericTraits<PointIdentifier>::max() )
00120 {}
00121 ~TriangleCell() {}
00122
00123 protected:
00125 std::vector< PointIdentifier > m_PointIds;
00126
00127 private:
00128 TriangleCell(const Self&);
00129 void operator=(const Self&);
00130
00133 double DistanceToLine(PointType x, PointType p1, PointType p2,
00134 double &t, CoordRepType *closestPoint);
00135 double DistanceToLine(PointType x, PointType p1, PointType p2,
00136 double &t, PointType &closestPoint);
00138
00139 };
00140
00141
00142 }
00143
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkTriangleCell.txx"
00146 #endif
00147
00148 #endif
00149