191 const
r_Minterval& clipDom, const
double& scaleFactor) throw(r_Error);
202 void scale(const
r_Point& origin, const
double& scaleFactor) throw(r_Error);
217 void shrinkPoly(
int pixelCount) throw(r_Error);
228 void checkFistPoint();
233 top, bottom, left, right
237 void fromPoints(
const std::vector<r_Point>& newPoints)
throw(
r_Error);
243 std::vector<r_Point> clip1Side(
const r_Minterval& b, r_Polygon::Side s);
258 std::vector<r_Edge> edges;
#define false
Definition: bool.h:23
Definition: polygon.hh:125
int countEdges() const
returns the number of edges
r_Polygon_Type
enum used to clasify one polygon
Definition: polygon.hh:123
void print_status(std::ostream &s=std::cout) const
print start and end point of the edge.
double getCurrX(r_Range y) const
retrieve x for a given y on a line with the slope of the edge. Calls getInvSlope().
std::ostream & operator<<(std::ostream &s, const r_Polygon &d)
Definition: polygon.hh:115
bool isHorizontal() const
returns true if the edge is parallel to the first axis
r_Polygon & operator=(const r_Polygon &)
asignment opertor
r_Polygon::r_Polygon_Type detectPolygonType() const
determine the polygon type for an polygon in 2D
int r_Range
Definition: mddtypes.hh:100
r_Minterval getBoundingBox() const
retrieve the bounding box of the polygon.
void close()
close a polygon after creation with addPointXY.
unsigned int r_Dimension
Definition: mddtypes.hh:118
void shrinkPoly(int pixelCount)
"shrink" polygon by moving all points towards the middle by pixelCount pixels.
Definition: polygon.hh:276
void fillMArray(r_GMarray &myArray, bool fillInside=false, const std::string &bgr="") const
Fill the 2-D array myArray according to the polygon.
Definition: polygon.hh:59
std::vector< r_Point > getPoints() const
retrieve a vector of all points in the polygon.
double getSlope() const
calculate slope of the edge. Note: may throw exception due to division by 0.
bool operator()(const r_Edge &e1, const r_Edge &e2) const
Definition: polygon.hh:296
void print_status(std::ostream &s=std::cout) const
print all edges of the polygon.
Definition: polygon.hh:291
Definition: gmarray.hh:66
Definition: polygon.hh:127
r_Point getMiddle() const
get "middle" point by averaging all x and y values.
r_Polygon()
default constructor.
void scale(const r_Point &origin, const r_Minterval &mddDom, const r_Minterval &clipDom, const double &scaleFactor)
scale the points of the polygon according to scaleFactor.
void clip(const r_Minterval &clipDom)
clip the polygon according to the bounding box specified in clipDom.
void addPoint(const r_Point &newPoint)
add a point to the polygon.
const r_Point & getEnd() const
retrieve 2-D end point of edge.
double getCurrY(r_Range x) const
retrieve y for a given x on a line with the slope of the edge. Calls getSlope().
r_Edge(const r_Point &newStart, const r_Point &newEnd)
constructor getting a 2-D start and end point.
const r_Point & getStart() const
retrieve 2-D start point of edge.
int countHorizontalEdges() const
returns the number of horizontal edges (used by polygon cut out)
Definition: polygon.hh:126
bool operator()(const r_Edge &e1, const r_Edge &e2) const
Definition: polygon.hh:281
void addPointXY(r_Range x, r_Range y)
add a point to the polygon specifying x and y.
void mirror(const r_Minterval &mddDom)
mirrors a polygon along the y-axes point by point.
static const r_Dimension polyPointDim
FIXME current we support only 2 dimensional polygon.
Definition: polygon.hh:120
const std::vector< r_Edge > & getEdges() const
retrieve the set of all edges of the polygon.
double getInvSlope() const
calculate inverse slope of the edge. Note: may throw exception due to division by 0...
Definition: minterval.hh:249