KWStyle - itkTriangleCell.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTriangleCell.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkTriangleCell_h
18 #define __itkTriangleCell_h
19
20 #include "itkCellInterface.h"
21 #include "itkLineCell.h"
22 #include "itkTriangleCellTopology.h"
23
24 namespace itk
25 {
26
27 /** \class TriangleCell
28  * TriangleCell represents a triangle for a Mesh.
29  *
30  * Template parameters for TriangleCell:
31  *
32  * TPixelType =
33  *     The type associated with a point, cell, or boundary for use in storing
34  *     its data.
35  *
36  * TCellTraits =
37  *     Type information of mesh containing cell.
38  *
39  * \ingroup MeshObjects
40  */
41
42 template < typename TCellInterface >
43 LEN class ITK_EXPORT TriangleCell: public TCellInterface, private TriangleCellTopology
44 {
45 public:
46   /** Standard class typedefs. */
47   itkCellCommonTypedefs(TriangleCell);
48   itkCellInheritedTypedefs(TCellInterface);
49
50   /** Standard part of every itk Object. */
51   itkTypeMacro(TriangleCell, CellInterface);
52   
53   /** The type of boundary for this triangle's vertices. */
54   typedef VertexCell< TCellInterface >            VertexType;
55   typedef typename VertexType::SelfAutoPointer    VertexAutoPointer;
56   
57   /** The type of boundary for this triangle's edges. */
58   typedef LineCell< TCellInterface >              EdgeType;
59   typedef typename EdgeType::SelfAutoPointer      EdgeAutoPointer;
60     
61   /** Triangle-specific topology numbers. */
62   itkStaticConstMacro(NumberOfPoints, unsigned int, 3);
63   itkStaticConstMacro(NumberOfVertices, unsigned int, 3);
64   itkStaticConstMacro(NumberOfEdges, unsigned int, 3);
65   itkStaticConstMacro(CellDimension, unsigned int, 2);
66   
67   /** Implement the standard CellInterface. */
68   virtual CellGeometry GetType(void) const 
69     {return Superclass::TRIANGLE_CELL;}
70   virtual void MakeCopy( CellAutoPointer & ) const;
71   virtual unsigned int GetDimension(void) const;
72   virtual unsigned int GetNumberOfPoints(void) const;
73   virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
74 LEN   virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &);
75   virtual void SetPointIds(PointIdConstIterator first);
76   virtual void SetPointIds(PointIdConstIterator first,
77                            PointIdConstIterator last);
78   virtual void SetPointId(int localId, PointIdentifier);
79   virtual PointIdIterator      PointIdsBegin(void);
80   virtual PointIdConstIterator PointIdsBegin(void) const;
81   virtual PointIdIterator      PointIdsEnd(void);
82   virtual PointIdConstIterator PointIdsEnd(void) const; 
83   
84   /** Triangle-specific interface. */
85   virtual CellFeatureCount GetNumberOfVertices(void) const;
86   virtual CellFeatureCount GetNumberOfEdges(void) const;
87   virtual bool  GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
88   virtual bool  GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
89   
90   virtual bool EvaluatePosition(CoordRepType*,
91                                 PointsContainer* ,
92                                 CoordRepType*,
93                                 CoordRepType [],
94                                 double *,
95                                 InterpolationWeightType*);
96
97   /** Cell visitor interface. */
98   itkCellVisitMacro(Superclass::TRIANGLE_CELL);
99
100 IND *public:
101   TriangleCell() {}
102   ~TriangleCell() {}
103
104 IND *protected:
105   /** Store the number of points needed for a triangle. */
106   PointIdentifier m_PointIds[NumberOfPoints];
107
108 IND *private:
109   TriangleCell(const Self&); //purposely not implemented
110   void operator=(const Self&); //purposely not implemented
111
112   double DistanceToLine(PointType x, PointType p1, PointType p2, 
113                               double &t, CoordRepType *closestPoint);
114   double DistanceToLine(PointType x, PointType p1, PointType p2, 
115                               double &t, PointType &closestPoint);
116 };
117
118
119 // end namespace itk
120
121 #ifndef ITK_MANUAL_INSTANTIATION
122 #include "itkTriangleCell.txx"
123 #endif
124
125 #endif
126

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:51PM
© Kitware Inc.