Inheritance diagram for w2img::TruthPolygon:
Public Member Functions | |
TruthPolygon () | |
bool | contains (float x, float y, float *distance_x=0, float *distance_y=0) const |
Is the given x,y inside this polygon? Optinally, pass in third parameter to get the distance of point from polygon boundary. | |
void | add (const TruthLine &side_of_polygon) |
Construct the polygon one side at a time. | |
void | setName (const std::string &n) |
const std::string & | getName () const |
void | closePolygon () |
Connects up end point of last side with start point of the first side. | |
float | computeArea () const |
The area of the polygon, assuming that the edges are in order. | |
float | getCx () const |
The centroid of the polygon assuming that the edges are in order. | |
float | getCy () const |
The centroid of the polygon assuming that the edges are in order. | |
float | max_x () const |
float | max_y () const |
float | min_x () const |
float | min_y () const |
Static Public Member Functions | |
static void | appendFromXML (const code::XML::Element &e, std::vector< TruthPolygon > *result) |
Pass in a polygons element or a polygon element. | |
static TruthPolygon | create (const code::SingleContourData &contour) |
Create polygon from contour data. |
w2img::TruthPolygon::TruthPolygon | ( | ) |
void w2img::TruthPolygon::add | ( | const TruthLine & | side_of_polygon | ) | [inline] |
Construct the polygon one side at a time.
If the lines you've added don't automatically close the polygon, remember to call closePolygon() after calling all the add()
static void w2img::TruthPolygon::appendFromXML | ( | const code::XML::Element & | e, | |
std::vector< TruthPolygon > * | result | |||
) | [static] |
Pass in a polygons element or a polygon element.
We'll parse it and add all the necessary elements.
void w2img::TruthPolygon::closePolygon | ( | ) |
Connects up end point of last side with start point of the first side.
float w2img::TruthPolygon::computeArea | ( | ) | const |
The area of the polygon, assuming that the edges are in order.
bool w2img::TruthPolygon::contains | ( | float | x, | |
float | y, | |||
float * | distance_x = 0 , |
|||
float * | distance_y = 0 | |||
) | const |
Is the given x,y inside this polygon? Optinally, pass in third parameter to get the distance of point from polygon boundary.
static TruthPolygon w2img::TruthPolygon::create | ( | const code::SingleContourData & | contour | ) | [static] |
Create polygon from contour data.
float w2img::TruthPolygon::getCx | ( | ) | const |
The centroid of the polygon assuming that the edges are in order.
float w2img::TruthPolygon::getCy | ( | ) | const |
The centroid of the polygon assuming that the edges are in order.
const std::string& w2img::TruthPolygon::getName | ( | ) | const [inline] |
float w2img::TruthPolygon::max_x | ( | ) | const |
float w2img::TruthPolygon::max_y | ( | ) | const |
float w2img::TruthPolygon::min_x | ( | ) | const |
float w2img::TruthPolygon::min_y | ( | ) | const |
void w2img::TruthPolygon::setName | ( | const std::string & | n | ) | [inline] |