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