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

◆ 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.

◆ toAtlas()

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

Create an Atlas object from the box.

Definition at line 399 of file atlasconv.h.


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