Chaste  Build::
Polygon< DIM > Class Template Reference

#include <Polygon.hpp>

+ Collaboration diagram for Polygon< DIM >:

Public Member Functions

 Polygon (std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > vertices)
 
 Polygon (boost::shared_ptr< DimensionalChastePoint< DIM > > pVertex)
 
 ~Polygon ()
 
void AddVertices (std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > vertices)
 
void AddVertex (boost::shared_ptr< DimensionalChastePoint< DIM > > pVertex)
 
bool ContainsPoint (const DimensionalChastePoint< DIM > &rLocation)
 
std::vector< units::quantity< unit::length > > GetBoundingBox ()
 
DimensionalChastePoint< DIM > GetCentroid ()
 
units::quantity< unit::length > GetDistance (const DimensionalChastePoint< DIM > &rLocation)
 
units::quantity< unit::length > GetDistanceToEdges (const DimensionalChastePoint< DIM > &rLocation)
 
vtkSmartPointer< vtkPlane > GetPlane ()
 
c_vector< double, DIM > GetNormal ()
 
boost::shared_ptr< DimensionalChastePoint< DIM > > GetVertex (unsigned idx)
 
std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > GetVertices ()
 
vtkSmartPointer< vtkPolygon > GetVtkPolygon ()
 
std::pair< vtkSmartPointer< vtkPoints >, vtkSmartPointer< vtkIdTypeArray > > GetVtkVertices ()
 
void ReplaceVertex (unsigned idx, boost::shared_ptr< DimensionalChastePoint< DIM > > pVertex)
 
void RotateAboutAxis (c_vector< double, 3 > axis, double angle)
 
void Translate (DimensionalChastePoint< DIM > translationVector)
 

Static Public Member Functions

static boost::shared_ptr< PolygonCreate (std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > vertices)
 
static boost::shared_ptr< PolygonCreate (boost::shared_ptr< DimensionalChastePoint< DIM > > pVertex)
 

Private Attributes

std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > mVertices
 
units::quantity< unit::length > mReferenceLength
 

Detailed Description

template<unsigned DIM>
class Polygon< DIM >

A collection of planar vertices, joined in the order they are added.

Definition at line 54 of file Polygon.hpp.

Constructor & Destructor Documentation

template<unsigned DIM>
Polygon< DIM >::Polygon ( std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > >  vertices)

Constructor

Parameters
verticesa vector of planar vertices, to be joined in the order they are added.

Definition at line 44 of file Polygon.cpp.

template<unsigned DIM>
Polygon< DIM >::Polygon ( boost::shared_ptr< DimensionalChastePoint< DIM > >  pVertex)

Constructor

Parameters
pVertexa vertex

Definition at line 52 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
Polygon< DIM >::~Polygon ( )

Desctructor

Definition at line 74 of file Polygon.cpp.

Member Function Documentation

template<unsigned DIM>
void Polygon< DIM >::AddVertex ( boost::shared_ptr< DimensionalChastePoint< DIM > >  pVertex)

Add vertex

Parameters
pVertexa vertex to be added. It is best to add multiple vertices at once.

Definition at line 86 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
void Polygon< DIM >::AddVertices ( std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > >  vertices)

Add vertices

Parameters
verticesa vector of planar vertices, to be joined in the order they are added.

Definition at line 79 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
bool Polygon< DIM >::ContainsPoint ( const DimensionalChastePoint< DIM > &  rLocation)

Return true if the specified location is in the polygon, uses vtk point in polygon.

Parameters
rLocationthe location to be tested
Returns
true if the location is in the polygon

Definition at line 273 of file Polygon.cpp.

References DimensionalChastePoint< DIM >::GetLocation(), Polygon< DIM >::GetVtkPolygon(), Polygon< DIM >::mReferenceLength, and Polygon< DIM >::mVertices.

template<unsigned DIM>
boost::shared_ptr< Polygon< DIM > > Polygon< DIM >::Create ( std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > >  vertices)
static

Factory constructor method

Parameters
verticesa vector of planar vertices, to be joined in the order they are added.
Returns
a shared pointer to a new polygon

Definition at line 60 of file Polygon.cpp.

Referenced by Part< DIM >::AddPolygon(), Part< DIM >::AddVesselNetwork(), Part< DIM >::Extrude(), VoronoiGenerator< DIM >::Generate(), and VesselSurfaceGenerator< DIM >::GetSurface().

template<unsigned DIM>
boost::shared_ptr< Polygon< DIM > > Polygon< DIM >::Create ( boost::shared_ptr< DimensionalChastePoint< DIM > >  pVertex)
static

Factory constructor method

Parameters
pVertexa vertex
Returns
a shared pointer to a new polygon

Definition at line 67 of file Polygon.cpp.

template<unsigned DIM>
std::vector< units::quantity< unit::length > > Polygon< DIM >::GetBoundingBox ( )

Return the bounding box of the polygon

Returns
the bounding box (xmin, xmax, ymin, ymax, zmin, zmax)

Definition at line 165 of file Polygon.cpp.

References Polygon< DIM >::GetVtkPolygon(), and Polygon< DIM >::mReferenceLength.

template<unsigned DIM>
DimensionalChastePoint< DIM > Polygon< DIM >::GetCentroid ( )

Return the centroid of the polygon

Returns
the centroid of the polygon

Definition at line 147 of file Polygon.cpp.

References Polygon< DIM >::GetVtkVertices(), and Polygon< DIM >::mReferenceLength.

Referenced by Polygon< DIM >::GetPlane().

template<unsigned DIM>
units::quantity< unit::length > Polygon< DIM >::GetDistance ( const DimensionalChastePoint< DIM > &  rLocation)

Return the distance to the polygon's plane

Parameters
rLocationthe location of the point to get the distance from
Returns
the distance to the plane containing the polygon

Definition at line 180 of file Polygon.cpp.

References DimensionalChastePoint< DIM >::GetLocation(), Polygon< DIM >::GetPlane(), and Polygon< DIM >::mReferenceLength.

template<unsigned DIM>
units::quantity< unit::length > Polygon< DIM >::GetDistanceToEdges ( const DimensionalChastePoint< DIM > &  rLocation)

Return the shortest distance to the polygon's edges

Parameters
rLocationthe location of the point to get the distance from
Returns
the shortest distance to the polygon edges

Definition at line 198 of file Polygon.cpp.

References DimensionalChastePoint< DIM >::GetLocation(), Polygon< DIM >::GetVtkPolygon(), and Polygon< DIM >::mReferenceLength.

template<unsigned DIM>
c_vector< double, DIM > Polygon< DIM >::GetNormal ( )

Return the normal to the polygon, must have 3 or more points

Returns
the normal to the polygon's plane

Definition at line 243 of file Polygon.cpp.

References Polygon< DIM >::GetVtkVertices(), and Polygon< DIM >::mVertices.

Referenced by Polygon< DIM >::GetPlane().

template<unsigned DIM>
vtkSmartPointer< vtkPlane > Polygon< DIM >::GetPlane ( )

Return the polygon's plane

Returns
a vtk plane on the polygon's plane

Definition at line 224 of file Polygon.cpp.

References Polygon< DIM >::GetCentroid(), Polygon< DIM >::GetNormal(), and Polygon< DIM >::mReferenceLength.

Referenced by Polygon< DIM >::GetDistance().

template<unsigned DIM>
boost::shared_ptr< DimensionalChastePoint< DIM > > Polygon< DIM >::GetVertex ( unsigned  idx)

Return the vertices

Parameters
idxindex of the vertex to return
Returns
pointer to the indexed vertex

Definition at line 92 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > Polygon< DIM >::GetVertices ( )

Return the vertices

Returns
the polygon's vertices

Definition at line 105 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
vtkSmartPointer< vtkPolygon > Polygon< DIM >::GetVtkPolygon ( )

Return a pointer to a VtkPolygon representation.

Returns
a vtk polygon representation of the polygon

Definition at line 134 of file Polygon.cpp.

References Polygon< DIM >::GetVtkVertices().

Referenced by Polygon< DIM >::ContainsPoint(), Polygon< DIM >::GetBoundingBox(), and Polygon< DIM >::GetDistanceToEdges().

template<unsigned DIM>
std::pair< vtkSmartPointer< vtkPoints >, vtkSmartPointer< vtkIdTypeArray > > Polygon< DIM >::GetVtkVertices ( )

Return the polygon vertices as a set of VtkPoints.

Returns
a pair consisting of vtk representation of the vertices and corresponding ids

Definition at line 111 of file Polygon.cpp.

References Polygon< DIM >::mReferenceLength, and Polygon< DIM >::mVertices.

Referenced by Polygon< DIM >::GetCentroid(), Polygon< DIM >::GetNormal(), and Polygon< DIM >::GetVtkPolygon().

template<unsigned DIM>
void Polygon< DIM >::ReplaceVertex ( unsigned  idx,
boost::shared_ptr< DimensionalChastePoint< DIM > >  pVertex 
)

Replace an exiting vertex with the passed in one.

Parameters
idxthe index of the vertex to be replaced
pVertexthe new vertex

Definition at line 310 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
void Polygon< DIM >::RotateAboutAxis ( c_vector< double, 3 >  axis,
double  angle 
)

Rotate about the specified axis by the specified angle

Parameters
axisthe rotation axis
anglethe rotation angle

Definition at line 323 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

template<unsigned DIM>
void Polygon< DIM >::Translate ( DimensionalChastePoint< DIM >  translationVector)

Move the polygon along the translation vector

Parameters
translationVectorthe new location is the original + the translationVector

Definition at line 332 of file Polygon.cpp.

References Polygon< DIM >::mVertices.

Member Data Documentation

template<unsigned DIM>
units::quantity<unit::length> Polygon< DIM >::mReferenceLength
private
template<unsigned DIM>
std::vector<boost::shared_ptr<DimensionalChastePoint<DIM> > > Polygon< DIM >::mVertices
private

The documentation for this class was generated from the following files: