ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkTriangleCell.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkTriangleCell_h
19 #define __itkTriangleCell_h
20 
21 #include "itkLineCell.h"
23 
24 #include <vector>
25 
26 namespace itk
27 {
44 template< typename TCellInterface >
46  public TCellInterface, private TriangleCellTopology
47 {
48 public:
51  itkCellInheritedTypedefs(TCellInterface);
53 
55  itkTypeMacro(TriangleCell, CellInterface);
56 
59  typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
60 
63  typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
64 
66  itkStaticConstMacro(NumberOfPoints, unsigned int, 3);
67  itkStaticConstMacro(NumberOfVertices, unsigned int, 3);
68  itkStaticConstMacro(NumberOfEdges, unsigned int, 3);
69  itkStaticConstMacro(CellDimension, unsigned int, 2);
71 
73  virtual CellGeometry GetType(void) const
74  { return Superclass::TRIANGLE_CELL; }
75  virtual void MakeCopy(CellAutoPointer &) const;
77 
78  virtual unsigned int GetDimension(void) const;
79 
80  virtual unsigned int GetNumberOfPoints(void) const;
81 
82  virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
83 
84  virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier,
85  CellAutoPointer &);
86  virtual void SetPointIds(PointIdConstIterator first);
87 
88  virtual void SetPointIds(PointIdConstIterator first,
89  PointIdConstIterator last);
90 
91  virtual void SetPointId(int localId, PointIdentifier);
92  virtual PointIdIterator PointIdsBegin(void);
93 
94  virtual PointIdConstIterator PointIdsBegin(void) const;
95 
96  virtual PointIdIterator PointIdsEnd(void);
97 
98  virtual PointIdConstIterator PointIdsEnd(void) const;
99 
101  virtual CellFeatureCount GetNumberOfVertices(void) const;
102 
103  virtual CellFeatureCount GetNumberOfEdges(void) const;
104 
105  virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
106  virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
107 
108  virtual bool EvaluatePosition(CoordRepType *,
109  PointsContainer *,
110  CoordRepType *,
111  CoordRepType[],
112  double *,
113  InterpolationWeightType *);
114 
116  itkCellVisitMacro(Superclass::TRIANGLE_CELL);
117 
119  CoordRepType ComputeArea(PointsContainer *);
120 
121  PointType ComputeBarycenter(CoordRepType *,
122  PointsContainer *);
123 
124  PointType ComputeCenterOfGravity(PointsContainer *);
125 
126  PointType ComputeCircumCenter(PointsContainer *);
127 
128 public:
130  m_PointIds( NumberOfPoints, NumericTraits< PointIdentifier >::max() )
131  {}
133 
134 protected:
136  std::vector< PointIdentifier > m_PointIds;
137 
138 private:
139  TriangleCell(const Self &); //purposely not implemented
140  void operator=(const Self &); //purposely not implemented
141 
144  double DistanceToLine(PointType x, PointType p1, PointType p2,
145  double & t, CoordRepType *closestPoint);
146 
147  double DistanceToLine(PointType x, PointType p1, PointType p2,
148  double & t, PointType & closestPoint);
149 };
150 } // end namespace itk
151 
152 #ifndef ITK_MANUAL_INSTANTIATION
153 #include "itkTriangleCell.hxx"
154 #endif
155 
156 #endif
VertexType::SelfAutoPointer VertexAutoPointer
PointType ComputeCenterOfGravity(PointsContainer *)
static const unsigned int CellDimension
Represents a line segment for a Mesh.
Definition: itkLineCell.h:42
virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &)
virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &)
itkCellCommonTypedefs(TriangleCell)
virtual void SetPointId(int localId, PointIdentifier)
virtual unsigned int GetNumberOfPoints(void) const
VertexCell< TCellInterface > VertexType
void operator=(const Self &)
An abstract interface for cells.
static const unsigned int NumberOfVertices
CoordRepType ComputeArea(PointsContainer *)
Compute Area to a TriangleCell given a PointsContainer.
double DistanceToLine(PointType x, PointType p1, PointType p2, double &t, CoordRepType *closestPoint)
virtual bool EvaluatePosition(CoordRepType *, PointsContainer *, CoordRepType *, CoordRepType[], double *, InterpolationWeightType *)
virtual PointIdIterator PointIdsEnd(void)
static const unsigned int NumberOfEdges
virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &)
virtual CellGeometry GetType(void) const
std::vector< PointIdentifier > m_PointIds
PointType ComputeCircumCenter(PointsContainer *)
virtual CellFeatureCount GetNumberOfVertices(void) const
virtual unsigned int GetDimension(void) const
virtual CellFeatureCount GetNumberOfEdges(void) const
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:39
virtual PointIdIterator PointIdsBegin(void)
itkCellInheritedTypedefs(TCellInterface)
static const unsigned int NumberOfPoints
virtual void SetPointIds(PointIdConstIterator first)
virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const
LineCell< TCellInterface > EdgeType
PointType ComputeBarycenter(CoordRepType *, PointsContainer *)
Define additional traits for native types such as int or float.
EdgeType::SelfAutoPointer EdgeAutoPointer
virtual void MakeCopy(CellAutoPointer &) const
itkCellVisitMacro(Superclass::TRIANGLE_CELL)