Definition
An instance r of the data type real_rectangle is an iso-oriented rectangle in the two-dimensional plane.
#include < LEDA/geo/real_rectangle.h >
Creation
real_rectangle | r(const real_point& p, const real_point& q) | |
introduces a variable r of type real_rectangle. r is initialized to the real_rectangle with diagonal corners p and q | ||
real_rectangle | r(const real_point& p, real w, real h) | |
introduces a variable r of type real_rectangle. r is initialized to the real_rectangle with lower left corner p, width w and height h. | ||
real_rectangle | r(real x1, real y1, real x2, real y2) | |
introduces a variable r of type real_rectangle. r is initialized to the real_rectangle with diagonal corners (x1,y1) and (x2,y2). | ||
real_rectangle | r(const rectangle& r1, int prec = 0) | |
introduces a variable r of type real_rectangle initialized to the rectangle r1. (The second argument is for compatibility with rat_rectangle.) | ||
real_rectangle | r(const rat_rectangle& r1) | |
introduces a variable r of type real_rectangle initialized to the rectangle r1. |
Operations
real_point | r.upper_left() | returns the upper left corner. |
real_point | r.upper_right() | returns the upper right corner. |
real_point | r.lower_left() | returns the lower left corner. |
real_point | r.lower_right() | returns the lower right corner. |
real_point | r.center() | returns the center of r. |
list<real_point> | r.vertices() | returns the vertices of r in counter-clockwise order starting from the lower left point. |
real | r.xmin() | returns the minimal x-coordinate of r. |
real | r.xmax() | returns the maximal x-coordinate of r. |
real | r.ymin() | returns the minimal y-coordinate of r. |
real | r.ymax() | returns the maximal y-coordinate of r. |
real | r.width() | returns the width of r. |
real | r.height() | returns the height of r. |
bool | r.is_degenerate() | returns true, if r degenerates to a segment or point (the 4 corners are collinear), false otherwise. |
bool | r.is_point() | returns true, if r degenerates to a point. |
bool | r.is_segment() | returns true, if r degenerates to a segment. |
int | r.cs_code(const real_point& p) | |
returns the code for Cohen-Sutherland algorithm. | ||
bool | r.inside(const real_point& p) | |
returns true, if p is inside of r, false otherwise. | ||
bool | r.outside(const real_point& p) | |
returns true, if p is outside of r, false otherwise. | ||
bool | r.inside_or_contains(const real_point& p) | |
returns true, if p is inside of r or on the border, false otherwise. | ||
bool | r.contains(const real_point& p) | |
returns true, if p is on the border of r, false otherwise. | ||
region_kind | r.region_of(const real_point& p) | |
returns BOUNDED_REGION if p lies in the bounded region of r, returns ON_REGION if p lies on r, and returns UNBOUNDED_REGION if p lies in the unbounded region. | ||
real_rectangle | r.include(const real_point& p) | |
returns a new rectangle that includes the points of r and p. | ||
real_rectangle | r.include(const real_rectangle& r2) | |
returns a new rectangle that includes the points of r and r2. | ||
real_rectangle | r.translate(real dx, real dy) | |
returns a new rectangle that is the translation of r by (dx,dy). | ||
real_rectangle | r.translate(const real_vector& v) | |
returns a new rectangle that is the translation of r by v. | ||
real_rectangle | r + const real_vector& v | returns r translated by v. |
real_rectangle | r - const real_vector& v | returns r translated by -v. |
real_point | r[int i] | returns the i-th vertex of r. Precondition: (0<i<5). |
real_rectangle | r.rotate90(const real_point& p, int i=1) | |
returns r rotated about p by an angle of i x 90 degrees. If i > 0 the rotation is counter-clockwise otherwise it is clockwise. | ||
real_rectangle | r.rotate90(int i=1) | returns r rotated by an angle of i x 90 degrees about the origin. |
real_rectangle | r.reflect(const real_point& p) | |
returns r reflected across p . | ||
list<real_point> | r.intersection(const real_segment& s) | |
returns r s . | ||
bool | r.clip(const real_segment& t, real_segment& inter) | |
clips t on r and returns the result in inter. | ||
bool | r.clip(const real_line& l, real_segment& inter) | |
clips l on r and returns the result in inter. | ||
bool | r.clip(const real_ray& ry, real_segment& inter) | |
clips ry on r and returns the result in inter. | ||
bool | r.difference(const real_rectangle& q, list<real_rectangle>& L) | |
returns true iff the difference of r and q is not empty, and false otherwise. The difference L is returned as a partition into rectangles. | ||
list<real_point> | r.intersection(const real_line& l) | |
returns r l. | ||
list<real_rectangle> | r.intersection(const real_rectangle& s) | |
returns r s. | ||
bool | r.do_intersect(const real_rectangle& b) | |
returns true iff r and b intersect, false otherwise. | ||
real | r.area() | returns the area of r. |