# PlotMM::DoubleRect Class Reference

List of all members.

## Detailed Description

Class defining a size in double coordinates.

## Public Member Functions

| DoubleRect ()
| DoubleRect (double x1, double x2, double y1, double y2)
| DoubleRect (double x, double y, const DoubleSize &)
bool | is_null () const
bool | is_empty () const
bool | is_valid () const
DoubleRect | normalize () const
double | get_x1 () const
double | get_x2 () const
double | get_y1 () const
double | get_y2 () const
void | set_x1 (double)
void | set_x2 (double)
void | set_y1 (double)
void | set_y2 (double)
DoublePoint | center () const
void | move_x (double x)
void | move_y (double y)
void | move (double x, double y)
void | move_by (double dx, double dy)
void | move_center (const DoublePoint &)
void | move_center (double dx, double dy)
void | set_rect (double x1, double x2, double y1, double y2)
double | get_width () const
double | get_height () const
DoubleSize | size () const
void | set_width (double w)
void | set_height (double h)
void | set_size (const DoubleSize &)
DoubleRect | operator| (const DoubleRect &r) const
DoubleRect | operator & (const DoubleRect &r) const
DoubleRect & | operator|= (const DoubleRect &r)
DoubleRect & | operator &= (const DoubleRect &r)
bool | operator== (const DoubleRect &) const
bool | operator!= (const DoubleRect &) const
bool | contains (const DoublePoint &p, bool proper=false) const
bool | contains (double x, double y, bool proper=false) const
bool | contains (const DoubleRect &r, bool proper=false) const
DoubleRect | unite (const DoubleRect &) const
DoubleRect | intersect (const DoubleRect &) const
bool | intersects (const DoubleRect &) const

## Constructor & Destructor Documentation

DoubleRect::DoubleRect | ( |  | ) |

| Constructs an rectangle with all components set to 0.0.

DoubleRect::DoubleRect | ( | double | x1,
|  | double | x2,
|  | double | y1,
|  | double | y2
| ) |

| Constructs an rectangle with x1 to x2 as x-range and, y1 to y2 as y-range.

DoubleRect::DoubleRect | ( | double | x,
|  | double | y,
|  | const DoubleSize & | size
| ) |

| Constructs an rectangle with x1 to x1 + size.width() as x-range and, y1 to y1 + size.height() as y-range.

## Member Function Documentation

DoublePoint DoubleRect::center | ( |  | ) | const

| Returns the center point of the rectangle.

bool DoubleRect::contains | ( | const DoubleRect & | other,
|  | bool | proper = `false`
| ) | const

| Returns TRUE if the rectangle other is inside this rectangle; otherwise returns FALSE. If proper is TRUE, this function returns TRUE only if other is entirely inside (not on the edge).

bool DoubleRect::contains | ( | double | x,
|  | double | y,
|  | bool | proper = `false`
| ) | const

| Returns TRUE if the point (x, y) is inside or on the edge of the rectangle; otherwise returns FALSE. If proper is TRUE, this function returns TRUE only if p is inside (not on the edge).

bool DoubleRect::contains | ( | const DoublePoint & | p,
|  | bool | proper = `false`
| ) | const

| Returns TRUE if the point p is inside or on the edge of the rectangle; otherwise returns FALSE. If proper is TRUE, this function returns TRUE only if p is inside (not on the edge).

double PlotMM::DoubleRect::get_height | ( |  | ) | const

| Returns the height.

double PlotMM::DoubleRect::get_width | ( |  | ) | const

| Returns the width.

double PlotMM::DoubleRect::get_x1 | ( |  | ) | const

| Returns x1.

double PlotMM::DoubleRect::get_x2 | ( |  | ) | const

| Returns x2.

double PlotMM::DoubleRect::get_y1 | ( |  | ) | const

| Returns y1.

double PlotMM::DoubleRect::get_y2 | ( |  | ) | const

| Returns y2.

DoubleRect DoubleRect::intersect | ( | const DoubleRect & | other | ) | const

| Returns the intersection of this rectangle and rectangle other. r.intersect(s) is equivalent to r&s.

bool DoubleRect::intersects | ( | const DoubleRect & | other | ) | const

| Returns TRUE if this rectangle intersects with rectangle other; otherwise returns FALSE.

bool PlotMM::DoubleRect::is_empty | ( |  | ) | const

| Returns TRUE if the rectangle is a empty rectangle; otherwise returns false. A rect is null when x1() >= x2() && y1() >= y2().

bool PlotMM::DoubleRect::is_null | ( |  | ) | const

| Returns TRUE if the rectangle is a null rectangle; otherwise returns false. A rect is null when x1() == x2() && y1() == y2().

bool PlotMM::DoubleRect::is_valid | ( |  | ) | const

| Returns TRUE if the rectangle is a valid rectangle; otherwise returns false. A rect is valid when x1() <= x2() && y1() <= y2().

void DoubleRect::move | ( | double | x,
|  | double | y
| ) |

| moves x1() to x and y1() to y, leaving the size unchanged

void DoubleRect::move_by | ( | double | dx,
|  | double | dy
| ) |

| moves x1() by dx and y1() by dy. leaving the size unchanged

void DoubleRect::move_center | ( | double | dx,
|  | double | dy
| ) |

| moves the center to (x, y), leaving the size unchanged

void DoubleRect::move_center | ( | const DoublePoint & |  | ) |

| moves the center to pos, leaving the size unchanged

void DoubleRect::move_x | ( | double | x | ) |

| moves x1() to x, leaving the size unchanged

void DoubleRect::move_y | ( | double | y | ) |

| moves y1() to y, leaving the size unchanged

DoubleRect DoubleRect::normalize | ( |  | ) | const

| Returns a normalized rectangle, i.e. a rectangle that has a non-negative width and height. It swaps x1 and x2 if x1() > x2(), and swaps y1 and y2 if y1() > y2().

DoubleRect DoubleRect::operator & | ( | const DoubleRect & | other | ) | const

| Returns the intersection of this rectangle and rectangle other. Returns an empty rectangle if there is no intersection.

DoubleRect & DoubleRect::operator &= | ( | const DoubleRect & | r | ) |

| Intersects this rectangle with rectangle other.

bool DoubleRect::operator!= | ( | const DoubleRect & |  | ) | const

| Returns TRUE if this rect and other are different; otherwise returns FALSE.

bool DoubleRect::operator== | ( | const DoubleRect & |  | ) | const

| Returns TRUE if this rect and other are equal; otherwise returns FALSE.

DoubleRect DoubleRect::operator| | ( | const DoubleRect & | other | ) | const

| Returns the bounding rectangle of this rectangle and rectangle other. The bounding rectangle of a nonempty rectangle and an empty or invalid rectangle is defined to be the nonempty rectangle.

DoubleRect & DoubleRect::operator|= | ( | const DoubleRect & | r | ) |

| Unites this rectangle with rectangle other.

void PlotMM::DoubleRect::set_height | ( | double | h | ) |

| Set the height, by y2 = y1 + h;.

void DoubleRect::set_rect | ( | double | x1,
|  | double | x2,
|  | double | y1,
|  | double | y2
| ) |

| Set the x-range from x1 to x2 and the y-range from y1 to y2.

void DoubleRect::set_size | ( | const DoubleSize & | size | ) |

| Sets the size of the rectangle to size. Changes x2 and y2 only.

void PlotMM::DoubleRect::set_width | ( | double | w | ) |

| Set the width, by x2 = x1 + w;.

void PlotMM::DoubleRect::set_x1 | ( | double |  | ) |

| Set x1.

void PlotMM::DoubleRect::set_x2 | ( | double |  | ) |

| Set x2.

void PlotMM::DoubleRect::set_y1 | ( | double |  | ) |

| Set y1.

void PlotMM::DoubleRect::set_y2 | ( | double |  | ) |

| Set y2.

DoubleSize PlotMM::DoubleRect::size | ( |  | ) | const

| Returns the size.

DoubleRect DoubleRect::unite | ( | const DoubleRect & | other | ) | const

| Returns the bounding rectangle of this rectangle and rectangle other. r.unite(s) is equivalent to r|s.