Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkTriangleCell.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkTriangleCell.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-03-03 15:11:01 $
00007   Version:   $Revision: 1.62 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00129   void operator=(const Self&); //purposely not implemented
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 } // end namespace itk
00143 
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkTriangleCell.txx"
00146 #endif
00147 
00148 #endif
00149 

Generated at Tue Sep 15 05:10:36 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000