wfmath 1.0.3
A math library for the Worldforge system.
WFMath::Polygon< 2 > Class Reference

The 2D specialization of the Polygon<> template. More...

#include <polygon.h>

Public Member Functions

 Polygon (const Polygon &p)=default
 
 Polygon (const AtlasInType &a)
 Construct a polygon from an object passed by Atlas. More...
 
AtlasOutType toAtlas () const
 Create an Atlas object from the box. More...
 
void fromAtlas (const AtlasInType &a)
 Set the box's value to that given by an Atlas object. More...
 
Polygonoperator= (const Polygon &p)=default
 
bool isEqualTo (const Polygon &p, CoordType epsilon=numeric_constants< CoordType >::epsilon()) const
 
bool operator== (const Polygon &p) const
 
bool operator!= (const Polygon &p) const
 
bool isValid () const
 
size_t numCorners () const
 
Point< 2 > getCorner (size_t i) const
 
Point< 2 > getCenter () const
 
bool addCorner (size_t i, const Point< 2 > &p, CoordType=numeric_constants< CoordType >::epsilon())
 
void removeCorner (size_t i)
 
bool moveCorner (size_t i, const Point< 2 > &p, CoordType=numeric_constants< CoordType >::epsilon())
 
void clear ()
 
const Point< 2 > & operator[] (size_t i) const
 
Point< 2 > & operator[] (size_t i)
 
void resize (std::vector< Point< 2 > >::size_type size)
 
Polygonshift (const Vector< 2 > &v)
 
PolygonmoveCornerTo (const Point< 2 > &p, size_t corner)
 
PolygonmoveCenterTo (const Point< 2 > &p)
 
PolygonrotateCorner (const RotMatrix< 2 > &m, size_t corner)
 
PolygonrotateCenter (const RotMatrix< 2 > &m)
 
PolygonrotatePoint (const RotMatrix< 2 > &m, const Point< 2 > &p)
 
AxisBox< 2 > boundingBox () const
 
Ball< 2 > boundingSphere () const
 
Ball< 2 > boundingSphereSloppy () const
 
Polygon toParentCoords (const Point< 2 > &origin, const RotMatrix< 2 > &rotation=RotMatrix< 2 >().identity()) const
 
Polygon toParentCoords (const AxisBox< 2 > &coords) const
 
Polygon toParentCoords (const RotBox< 2 > &coords) const
 
Polygon toLocalCoords (const Point< 2 > &origin, const RotMatrix< 2 > &rotation=RotMatrix< 2 >().identity()) const
 
Polygon toLocalCoords (const AxisBox< 2 > &coords) const
 
Polygon toLocalCoords (const RotBox< 2 > &coords) const
 

Friends

std::ostream & operator (std::ostream &os, const Polygon &p)
 
std::istream & operator>> (std::istream &is, Polygon &p)
 
bool Intersect (const Polygon &r, const Point< 2 > &p, bool proper)
 
bool Contains (const Point< 2 > &p, const Polygon &r, bool proper)
 
bool Intersect (const Polygon &p, const AxisBox< 2 > &b, bool proper)
 
bool Contains (const Polygon &p, const AxisBox< 2 > &b, bool proper)
 
bool Contains (const AxisBox< 2 > &b, const Polygon &p, bool proper)
 
bool Intersect (const Polygon &p, const Ball< 2 > &b, bool proper)
 
bool Contains (const Polygon &p, const Ball< 2 > &b, bool proper)
 
bool Contains (const Ball< 2 > &b, const Polygon &p, bool proper)
 
bool Intersect (const Polygon &p, const Segment< 2 > &s, bool proper)
 
bool Contains (const Polygon &p, const Segment< 2 > &s, bool proper)
 
bool Contains (const Segment< 2 > &s, const Polygon &p, bool proper)
 
bool Intersect (const Polygon &p, const RotBox< 2 > &r, bool proper)
 
bool Contains (const Polygon &p, const RotBox< 2 > &r, bool proper)
 
bool Contains (const RotBox< 2 > &r, const Polygon &p, bool proper)
 
bool Intersect (const Polygon &p1, const Polygon &p2, bool proper)
 
bool Contains (const Polygon &outer, const Polygon &inner, bool proper)
 

Detailed Description

The 2D specialization of the Polygon<> template.

Definition at line 47 of file polygon.h.

Constructor & Destructor Documentation

◆ Polygon()

WFMath::Polygon< 2 >::Polygon ( const AtlasInType a)
inlineexplicit

Construct a polygon from an object passed by Atlas.

Definition at line 53 of file polygon.h.

Member Function Documentation

◆ addCorner()

bool WFMath::Polygon< 2 >::addCorner ( size_t  i,
const Point< 2 > &  p,
CoordType  = numeric_constants<CoordType>::epsilon() 
)
inline

Definition at line 86 of file polygon.h.

◆ boundingBox()

AxisBox< 2 > WFMath::Polygon< 2 >::boundingBox ( ) const
inline

Definition at line 120 of file polygon.h.

◆ boundingSphere()

Ball< 2 > WFMath::Polygon< 2 >::boundingSphere ( ) const
inline

Definition at line 121 of file polygon.h.

◆ boundingSphereSloppy()

Ball< 2 > WFMath::Polygon< 2 >::boundingSphereSloppy ( ) const
inline

Definition at line 122 of file polygon.h.

◆ clear()

void WFMath::Polygon< 2 >::clear ( )
inline

Definition at line 97 of file polygon.h.

◆ fromAtlas()

void WFMath::Polygon< 2 >::fromAtlas ( const AtlasInType a)
inline

Set the box's value to that given by an Atlas object.

Definition at line 378 of file atlasconv.h.

◆ getCenter()

Point< 2 > WFMath::Polygon< 2 >::getCenter ( ) const
inline

Definition at line 79 of file polygon.h.

◆ getCorner()

Point< 2 > WFMath::Polygon< 2 >::getCorner ( size_t  i) const
inline

Definition at line 78 of file polygon.h.

◆ isEqualTo()

bool WFMath::Polygon< 2 >::isEqualTo ( const Polygon< 2 > &  p,
CoordType  epsilon = numeric_constants<CoordType>::epsilon() 
) const

Definition at line 76 of file polygon.cpp.

◆ isValid()

bool WFMath::Polygon< 2 >::isValid ( ) const

Definition at line 94 of file polygon.cpp.

◆ moveCenterTo()

Polygon & WFMath::Polygon< 2 >::moveCenterTo ( const Point< 2 > &  p)
inline

Definition at line 109 of file polygon.h.

◆ moveCorner()

bool WFMath::Polygon< 2 >::moveCorner ( size_t  i,
const Point< 2 > &  p,
CoordType  = numeric_constants<CoordType>::epsilon() 
)
inline

Definition at line 93 of file polygon.h.

◆ moveCornerTo()

Polygon & WFMath::Polygon< 2 >::moveCornerTo ( const Point< 2 > &  p,
size_t  corner 
)
inline

Definition at line 107 of file polygon.h.

◆ numCorners()

size_t WFMath::Polygon< 2 >::numCorners ( ) const
inline

Definition at line 77 of file polygon.h.

◆ operator!=()

bool WFMath::Polygon< 2 >::operator!= ( const Polygon< 2 > &  p) const
inline

Definition at line 71 of file polygon.h.

◆ operator==()

bool WFMath::Polygon< 2 >::operator== ( const Polygon< 2 > &  p) const
inline

Definition at line 70 of file polygon.h.

◆ operator[]() [1/2]

Point< 2 > & WFMath::Polygon< 2 >::operator[] ( size_t  i)
inline

Definition at line 100 of file polygon.h.

◆ operator[]() [2/2]

const Point< 2 > & WFMath::Polygon< 2 >::operator[] ( size_t  i) const
inline

Definition at line 99 of file polygon.h.

◆ removeCorner()

void WFMath::Polygon< 2 >::removeCorner ( size_t  i)
inline

Definition at line 90 of file polygon.h.

◆ resize()

void WFMath::Polygon< 2 >::resize ( std::vector< Point< 2 > >::size_type  size)
inline

Definition at line 102 of file polygon.h.

◆ rotateCenter()

Polygon & WFMath::Polygon< 2 >::rotateCenter ( const RotMatrix< 2 > &  m)
inline

Definition at line 114 of file polygon.h.

◆ rotateCorner()

Polygon & WFMath::Polygon< 2 >::rotateCorner ( const RotMatrix< 2 > &  m,
size_t  corner 
)
inline

Definition at line 112 of file polygon.h.

◆ rotatePoint()

Polygon< 2 > & WFMath::Polygon< 2 >::rotatePoint ( const RotMatrix< 2 > &  m,
const Point< 2 > &  p 
)

Definition at line 114 of file polygon.cpp.

◆ shift()

Polygon< 2 > & WFMath::Polygon< 2 >::shift ( const Vector< 2 > &  v)

Definition at line 105 of file polygon.cpp.

◆ toAtlas()

AtlasOutType WFMath::Polygon< 2 >::toAtlas ( ) const
inline

Create an Atlas object from the box.

Definition at line 399 of file atlasconv.h.

◆ toLocalCoords() [1/3]

Polygon< 2 > WFMath::Polygon< 2 >::toLocalCoords ( const AxisBox< 2 > &  coords) const

Definition at line 165 of file polygon.cpp.

◆ toLocalCoords() [2/3]

Polygon< 2 > WFMath::Polygon< 2 >::toLocalCoords ( const Point< 2 > &  origin,
const RotMatrix< 2 > &  rotation = RotMatrix<2>().identity() 
) const

Definition at line 154 of file polygon.cpp.

◆ toLocalCoords() [3/3]

Polygon< 2 > WFMath::Polygon< 2 >::toLocalCoords ( const RotBox< 2 > &  coords) const

Definition at line 175 of file polygon.cpp.

◆ toParentCoords() [1/3]

Polygon< 2 > WFMath::Polygon< 2 >::toParentCoords ( const AxisBox< 2 > &  coords) const

Definition at line 134 of file polygon.cpp.

◆ toParentCoords() [2/3]

Polygon< 2 > WFMath::Polygon< 2 >::toParentCoords ( const Point< 2 > &  origin,
const RotMatrix< 2 > &  rotation = RotMatrix<2>().identity() 
) const

Definition at line 123 of file polygon.cpp.

◆ toParentCoords() [3/3]

Polygon< 2 > WFMath::Polygon< 2 >::toParentCoords ( const RotBox< 2 > &  coords) const

Definition at line 144 of file polygon.cpp.

Friends And Related Function Documentation

◆ Contains

bool Contains ( const Polygon< 2 > &  outer,
const Polygon< 2 > &  inner,
bool  proper 
)
friend

Definition at line 668 of file polygon_intersect.cpp.

◆ Intersect

bool Intersect ( const Polygon< 2 > &  p1,
const Polygon< 2 > &  p2,
bool  proper 
)
friend

Definition at line 654 of file polygon_intersect.cpp.

◆ operator>>

std::istream & operator>> ( std::istream &  is,
Polygon< 2 > &  p 
)
friend

Definition at line 68 of file stream.cpp.


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