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 namespace itk
00025 {
00026
00042 template < typename TCellInterface >
00043 class ITK_EXPORT TriangleCell: public TCellInterface, private TriangleCellTopology
00044 {
00045 public:
00047 itkCellCommonTypedefs(TriangleCell);
00048 itkCellInheritedTypedefs(TCellInterface);
00049
00051 itkTypeMacro(TriangleCell, CellInterface);
00052
00054 typedef VertexCell< TCellInterface > VertexType;
00055 typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
00056
00058 typedef LineCell< TCellInterface > EdgeType;
00059 typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
00060
00062 itkStaticConstMacro(NumberOfPoints, unsigned int, 3);
00063 itkStaticConstMacro(NumberOfVertices, unsigned int, 3);
00064 itkStaticConstMacro(NumberOfEdges, unsigned int, 3);
00065 itkStaticConstMacro(CellDimension, unsigned int, 2);
00066
00068 virtual CellGeometry GetType(void) const
00069 {return Superclass::TRIANGLE_CELL;}
00070 virtual void MakeCopy( CellAutoPointer & ) const;
00071 virtual unsigned int GetDimension(void) const;
00072 virtual unsigned int GetNumberOfPoints(void) const;
00073 virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
00074 virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &);
00075 virtual void SetPointIds(PointIdConstIterator first);
00076 virtual void SetPointIds(PointIdConstIterator first,
00077 PointIdConstIterator last);
00078 virtual void SetPointId(int localId, PointIdentifier);
00079 virtual PointIdIterator PointIdsBegin(void);
00080 virtual PointIdConstIterator PointIdsBegin(void) const;
00081 virtual PointIdIterator PointIdsEnd(void);
00082 virtual PointIdConstIterator PointIdsEnd(void) const;
00083
00085 virtual CellFeatureCount GetNumberOfVertices(void) const;
00086 virtual CellFeatureCount GetNumberOfEdges(void) const;
00087 virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
00088 virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
00089
00090 virtual bool EvaluatePosition(CoordRepType*,
00091 PointsContainer* ,
00092 CoordRepType*,
00093 CoordRepType [],
00094 double *,
00095 InterpolationWeightType*);
00096
00098 itkCellVisitMacro(Superclass::TRIANGLE_CELL);
00099
00100 public:
00101 TriangleCell() {}
00102 ~TriangleCell() {}
00103
00104 protected:
00106 PointIdentifier m_PointIds[NumberOfPoints];
00107
00108 private:
00109 TriangleCell(const Self&);
00110 void operator=(const Self&);
00111
00112 double DistanceToLine(PointType x, PointType p1, PointType p2,
00113 double &t, CoordRepType *closestPoint);
00114 double DistanceToLine(PointType x, PointType p1, PointType p2,
00115 double &t, PointType &closestPoint);
00116 };
00117
00118
00119 }
00120
00121 #ifndef ITK_MANUAL_INSTANTIATION
00122 #include "itkTriangleCell.txx"
00123 #endif
00124
00125 #endif