Public Member Functions | Static Public Member Functions | Public Attributes
P::SPolygon Class Reference

#include <SPolygon.hh>

List of all members.

Public Member Functions

double Area ()
void CenterOfGravity ()
void Clear ()
void Expand (double d)
void Insert (Vector2 &p)
bool Inside (double x, double y)
bool Inside (Vector2 &p)
void Move (Vector2 &dist)
 Move the whole polygon (and center) by dist.
unsigned NumVertices ()
bool OnContour (double x, double y, double eps)
SPolygonoperator= (const SPolygon &p)
Vector2operator[] (unsigned i)
void PushBack (Vector2 &p)
void SetConvexHull (Array< Vector2 > &p)
unsigned Size ()
 SPolygon ()
 SPolygon (Array< Vector2 > &p)
 ~SPolygon ()

Static Public Member Functions

static double Area (Array< Vector2 > &vs)
 Calculate area of polygon.
static void CenterOfGravity (Array< Vector2 > &vs, Vector2 &vc)
 Calculate center of gravity.
static bool Inside (Array< Vector2 > &vs, Vector2 &p)
static void Load (ifstream &is, SPolygon &p)
static double Match (Array< Vector2 > &vs1, Array< Vector2 > &vs2)
 Match two polygons using Hausdorff distance.
static double NearestLine (Vector2 &p, Array< Vector2 > &vs, unsigned &id)
static double NearestNeighbour (Vector2 &p, Array< Vector2 > &vs, unsigned &id)
static void Save (ofstream &os, const SPolygon &p)

Public Attributes

Vector2 center
unsigned p
Array< Vector2v

Detailed Description

Definition at line 25 of file SPolygon.hh.


Constructor & Destructor Documentation

Definition at line 18 of file SPolygon.cc.

Definition at line 34 of file SPolygon.cc.

P::SPolygon::~SPolygon ( ) [inline]

Definition at line 37 of file SPolygon.hh.


Member Function Documentation

double P::SPolygon::Area ( ) [inline]

Definition at line 49 of file SPolygon.hh.

double P::SPolygon::Area ( Array< Vector2 > &  vs) [static]

Calculate area of polygon.

Definition at line 242 of file SPolygon.cc.

void P::SPolygon::CenterOfGravity ( ) [inline]

Definition at line 67 of file SPolygon.hh.

void P::SPolygon::CenterOfGravity ( Array< Vector2 > &  vs,
Vector2 vc 
) [static]

Calculate center of gravity.

Definition at line 228 of file SPolygon.cc.

void P::SPolygon::Clear ( ) [inline]

Definition at line 43 of file SPolygon.hh.

void P::SPolygon::Expand ( double  d)

Definition at line 58 of file SPolygon.cc.

void P::SPolygon::Insert ( Vector2 p) [inline]

Definition at line 47 of file SPolygon.hh.

bool P::SPolygon::Inside ( double  x,
double  y 
)

Checks whether point p is inside polygon. Uses the Jordan curve theorem. Note that points on the boundary are undefined. Code thanks to W Randolph Franklin (WRF) http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html int pnpoly(int npol, float *xp, float *yp, float x, float y) { int i, j, c = 0; for (i = 0, j = npol-1; i < npol; j = i++) { if ((((yp[i]<=y) && (y<yp[j])) || ((yp[j]<=y) && (y<yp[i]))) && (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i]))

c = !c; } return c; }

Definition at line 114 of file SPolygon.cc.

bool P::SPolygon::Inside ( Vector2 p) [inline]

Definition at line 42 of file SPolygon.hh.

bool P::SPolygon::Inside ( Array< Vector2 > &  vs,
Vector2 p 
) [static]

Definition at line 138 of file SPolygon.cc.

void P::SPolygon::Load ( ifstream &  is,
SPolygon p 
) [static]

Definition at line 276 of file SPolygon.cc.

double P::SPolygon::Match ( Array< Vector2 > &  vs1,
Array< Vector2 > &  vs2 
) [static]

Match two polygons using Hausdorff distance.

Definition at line 195 of file SPolygon.cc.

void P::SPolygon::Move ( Vector2 dist) [inline]

Move the whole polygon (and center) by dist.

Definition at line 80 of file SPolygon.hh.

double P::SPolygon::NearestLine ( Vector2 p,
Array< Vector2 > &  vs,
unsigned &  id 
) [static]

search for nearest line to point (normal length between two end points)

Definition at line 171 of file SPolygon.cc.

double P::SPolygon::NearestNeighbour ( Vector2 p,
Array< Vector2 > &  vs,
unsigned &  id 
) [static]

search for nearest neighbour of a point in 2d

Definition at line 155 of file SPolygon.cc.

unsigned P::SPolygon::NumVertices ( ) [inline]

Definition at line 46 of file SPolygon.hh.

bool P::SPolygon::OnContour ( double  x,
double  y,
double  eps 
)

Definition at line 128 of file SPolygon.cc.

SPolygon & P::SPolygon::operator= ( const SPolygon p)

Definition at line 41 of file SPolygon.cc.

Vector2& P::SPolygon::operator[] ( unsigned  i) [inline]

Definition at line 62 of file SPolygon.hh.

void P::SPolygon::PushBack ( Vector2 p) [inline]

Definition at line 45 of file SPolygon.hh.

void P::SPolygon::Save ( ofstream &  os,
const SPolygon p 
) [static]

Definition at line 265 of file SPolygon.cc.

SetConvexHull Calculates the convex hull of p

Definition at line 53 of file SPolygon.cc.

unsigned P::SPolygon::Size ( ) [inline]

Definition at line 44 of file SPolygon.hh.


Member Data Documentation

Definition at line 29 of file SPolygon.hh.

unsigned P::SPolygon::p

Definition at line 30 of file SPolygon.hh.

Definition at line 28 of file SPolygon.hh.


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


blort
Author(s): Michael Zillich, Thomas Mörwald, Johann Prankl, Andreas Richtsfeld, Bence Magyar (ROS version)
autogenerated on Thu Jan 2 2014 11:38:26