#include <rectangle.h>
Inheritance diagram for geometric::rectangle< numeric_type >:


Public Member Functions | |
| rectangle (const point< numeric_type > &vertex_1, const point< numeric_type > &vertex_2) | |
| rectangle (numeric_type x_1=0, numeric_type y_1=0, numeric_type x_2=0, numeric_type y_2=0) | |
| numeric_type | height () const |
| numeric_type | width () const |
| rectangle | order () const |
| Re-orders the vertices of the line to be increasing. | |
| point< numeric_type > | top_left () const |
| point< numeric_type > | bottom_left () const |
| point< numeric_type > | top_right () const |
| point< numeric_type > | bottom_right () const |
| returns the appropriate point as represented by our rectangle. | |
| numeric_type | minimum_x () const |
| Return the smallest x from the points in the rectangle. | |
| numeric_type | minimum_y () const |
| Return the smallest y from the points in the rectangle. | |
| numeric_type | maximum_x () const |
| Return the largest x from the points in the rectangle. | |
| numeric_type | maximum_y () const |
| Return the largest y from the points in the rectangle. | |
| point< numeric_type > | center () const |
| Returns the point at the center of the rectangle. | |
| bool | inside (const point< numeric_type > &to_check) const |
| Returns true if `to_check' is inside `this' rectangle. | |
| bool | operator== (const rectangle &to_compare) const |
| Returns true if `to_compare' has vertices equal to `this'. | |
| bool | operator!= (const rectangle &to_compare) const |
| Returns true if `to_compare' has different vertices than `this'. | |
| rectangle | operator+ (const point< numeric_type > &to_add) const |
| Returns the rectangle resulting from adding a point to its vertices. | |
| rectangle | operator- (const point< numeric_type > &to_subtract) const |
| Returns the rectangle resulting from subtracting "to_subtract". | |
| rectangle & | operator+= (const point< numeric_type > &to_add) |
| Adds the point "to_add" to our vertices. | |
| rectangle & | operator-= (const point< numeric_type > &to_subtract) |
| Subtracts the point "to_add" to our vertices. | |
| void | encompass (const rectangle &to_adjust_to) |
| Finds the largest dimension needed to contain all rectangles passed in. | |
| bool | intersect (const rectangle &r2) const |
| Returns true if `this' & `r2' cover any common points. | |
| bool | disjoint (const rectangle &r2) const |
| Returns true if `this' & `r2' have mutually exclusive extents. | |
| bool | join_intersecting (const rectangle &r2, rectangle &result) |
| Sets "result" to encompass this and "r2" if they intersect. | |
| bool | intersection (const rectangle &r2, rectangle &result) |
| Sets "result" to the intersection of this and "r2". | |
| istring | text_form () const |
| Prints out the contents of the rectangle. | |
| bool | from_text (const istring &text) |
| Returns true if the "text" is parsed into this rectangle. | |
| point< numeric_type > | vertex_1 () const |
| point< numeric_type > | vertex_2 () const |
| void | vertex_1 (const point< numeric_type > &to_set) |
| void | vertex_2 (const point< numeric_type > &to_set) |
| virtual void | pack (byte_array &packed_form) const |
| Creates a packed form of the packable object in "packed_form". | |
| virtual bool | unpack (byte_array &packed_form) |
| Restores the packable from the "packed_form". | |
Protected Attributes | |
| point< numeric_type > | _vertex_1 |
| point< numeric_type > | _vertex_2 |
Definition at line 25 of file rectangle.h.
| geometric::rectangle< numeric_type >::rectangle | ( | const point< numeric_type > & | vertex_1, | |
| const point< numeric_type > & | vertex_2 | |||
| ) |
Definition at line 26 of file rectangle.cpp.
| geometric::rectangle< numeric_type >::rectangle | ( | numeric_type | x_1 = 0, |
|
| numeric_type | y_1 = 0, |
|||
| numeric_type | x_2 = 0, |
|||
| numeric_type | y_2 = 0 | |||
| ) |
Definition at line 30 of file rectangle.cpp.
| numeric_type geometric::rectangle< numeric_type >::height | ( | ) | const |
Definition at line 51 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and absolute_value().
Referenced by EVT_COMMAND().
| numeric_type geometric::rectangle< numeric_type >::width | ( | ) | const |
Definition at line 55 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and absolute_value().
Referenced by EVT_COMMAND().
| rectangle< numeric_type > geometric::rectangle< numeric_type >::order | ( | ) | const |
Re-orders the vertices of the line to be increasing.
Orients the vertices such that the x and y coordinates of the first vertex are respectively closer to the origin than the x and y coordinates of the second vertex (or they are equidistant).
Reimplemented in geometric::screen_rectangle.
Definition at line 75 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and flip_increasing().
Referenced by geometric::rectangle< numeric_type >::bottom_left(), geometric::rectangle< numeric_type >::bottom_right(), geometric::rectangle< numeric_type >::inside(), geometric::rectangle< numeric_type >::top_left(), and geometric::rectangle< numeric_type >::top_right().
| point< numeric_type > geometric::rectangle< numeric_type >::top_left | ( | ) | const |
Reimplemented in geometric::screen_rectangle.
Definition at line 87 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::order(), geometric::rectangle< numeric_type >::vertex_1(), and geometric::rectangle< numeric_type >::vertex_2().
| point< numeric_type > geometric::rectangle< numeric_type >::bottom_left | ( | ) | const |
Reimplemented in geometric::screen_rectangle.
Definition at line 94 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::order(), and geometric::rectangle< numeric_type >::vertex_1().
| point< numeric_type > geometric::rectangle< numeric_type >::top_right | ( | ) | const |
Reimplemented in geometric::screen_rectangle.
Definition at line 101 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::order(), and geometric::rectangle< numeric_type >::vertex_2().
| point< numeric_type > geometric::rectangle< numeric_type >::bottom_right | ( | ) | const |
returns the appropriate point as represented by our rectangle.
note that these are with respect to a normal cartesian coordinate system. if you want points for a screen based coordinate system (with the origin in the top left), then bottom_left and top_right return the appropriate bounding points for that rectangle.
Reimplemented in geometric::screen_rectangle.
Definition at line 108 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::order(), geometric::rectangle< numeric_type >::vertex_1(), and geometric::rectangle< numeric_type >::vertex_2().
| numeric_type geometric::rectangle< numeric_type >::minimum_x | ( | ) | const |
Return the smallest x from the points in the rectangle.
Definition at line 59 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and minimum().
Referenced by geometric::rectangle< numeric_type >::disjoint(), geometric::rectangle< numeric_type >::intersection(), and geometric::rectangle< numeric_type >::operator==().
| numeric_type geometric::rectangle< numeric_type >::minimum_y | ( | ) | const |
Return the smallest y from the points in the rectangle.
Definition at line 63 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and minimum().
Referenced by geometric::rectangle< numeric_type >::disjoint(), geometric::rectangle< numeric_type >::intersection(), and geometric::rectangle< numeric_type >::operator==().
| numeric_type geometric::rectangle< numeric_type >::maximum_x | ( | ) | const |
Return the largest x from the points in the rectangle.
Definition at line 67 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and maximum().
Referenced by geometric::rectangle< numeric_type >::disjoint(), geometric::rectangle< numeric_type >::intersection(), and geometric::rectangle< numeric_type >::operator==().
| numeric_type geometric::rectangle< numeric_type >::maximum_y | ( | ) | const |
Return the largest y from the points in the rectangle.
Definition at line 71 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, and maximum().
Referenced by geometric::rectangle< numeric_type >::disjoint(), geometric::rectangle< numeric_type >::intersection(), and geometric::rectangle< numeric_type >::operator==().
| point< numeric_type > geometric::rectangle< numeric_type >::center | ( | ) | const |
Returns the point at the center of the rectangle.
Definition at line 115 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
Referenced by main().
| bool geometric::rectangle< numeric_type >::inside | ( | const point< numeric_type > & | to_check | ) | const |
Returns true if `to_check' is inside `this' rectangle.
Definition at line 123 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, geometric::rectangle< numeric_type >::_vertex_2, geometric::rectangle< numeric_type >::order(), geometric::point< numeric_type >::x(), and geometric::point< numeric_type >::y().
| bool geometric::rectangle< numeric_type >::operator== | ( | const rectangle< numeric_type > & | to_compare | ) | const |
Returns true if `to_compare' has vertices equal to `this'.
Definition at line 133 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::maximum_x(), geometric::rectangle< numeric_type >::maximum_y(), geometric::rectangle< numeric_type >::minimum_x(), and geometric::rectangle< numeric_type >::minimum_y().
| bool geometric::rectangle< numeric_type >::operator!= | ( | const rectangle< numeric_type > & | to_compare | ) | const |
Returns true if `to_compare' has different vertices than `this'.
Definition at line 144 of file rectangle.cpp.
| rectangle< numeric_type > geometric::rectangle< numeric_type >::operator+ | ( | const point< numeric_type > & | to_add | ) | const |
Returns the rectangle resulting from adding a point to its vertices.
Definition at line 156 of file rectangle.cpp.
| rectangle< numeric_type > geometric::rectangle< numeric_type >::operator- | ( | const point< numeric_type > & | to_subtract | ) | const |
Returns the rectangle resulting from subtracting "to_subtract".
Definition at line 179 of file rectangle.cpp.
| rectangle< numeric_type > & geometric::rectangle< numeric_type >::operator+= | ( | const point< numeric_type > & | to_add | ) |
Adds the point "to_add" to our vertices.
Definition at line 148 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
| rectangle< numeric_type > & geometric::rectangle< numeric_type >::operator-= | ( | const point< numeric_type > & | to_subtract | ) |
Subtracts the point "to_add" to our vertices.
Definition at line 152 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
| void geometric::rectangle< numeric_type >::encompass | ( | const rectangle< numeric_type > & | to_adjust_to | ) |
Finds the largest dimension needed to contain all rectangles passed in.
The original dimension of `this' rectangle is compared with all subsequent rectangles passed to adjust_dimension, and it is modified (joined with `to_adjust_to') if the extent of `to_adjust_to' is greater or lesser than the current extent of `this' rectangle.
Definition at line 187 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
Referenced by geometric::rectangle< numeric_type >::join_intersecting().
| bool geometric::rectangle< numeric_type >::intersect | ( | const rectangle< numeric_type > & | r2 | ) | const |
Returns true if `this' & `r2' cover any common points.
Definition at line 210 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::disjoint().
| bool geometric::rectangle< numeric_type >::disjoint | ( | const rectangle< numeric_type > & | r2 | ) | const |
Returns true if `this' & `r2' have mutually exclusive extents.
Definition at line 200 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::maximum_x(), geometric::rectangle< numeric_type >::maximum_y(), geometric::rectangle< numeric_type >::minimum_x(), and geometric::rectangle< numeric_type >::minimum_y().
Referenced by geometric::rectangle< numeric_type >::intersect(), geometric::rectangle< numeric_type >::intersection(), and geometric::rectangle< numeric_type >::join_intersecting().
| bool geometric::rectangle< numeric_type >::join_intersecting | ( | const rectangle< numeric_type > & | r2, | |
| rectangle< numeric_type > & | result | |||
| ) |
Sets "result" to encompass this and "r2" if they intersect.
If `this' and `r2' intersect, `result' is adjusted to their dimension and true is returned. If not, false is returned and `result' is undefined.
Definition at line 214 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::disjoint(), and geometric::rectangle< numeric_type >::encompass().
| bool geometric::rectangle< numeric_type >::intersection | ( | const rectangle< numeric_type > & | r2, | |
| rectangle< numeric_type > & | result | |||
| ) |
Sets "result" to the intersection of this and "r2".
If `this' and `r2' intersect, then `result' is set to their intersecting extent and true is returned. If not, then false is returned and `result' is undefined.
Definition at line 223 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::disjoint(), maximum(), geometric::rectangle< numeric_type >::maximum_x(), geometric::rectangle< numeric_type >::maximum_y(), minimum(), geometric::rectangle< numeric_type >::minimum_x(), and geometric::rectangle< numeric_type >::minimum_y().
| istring geometric::rectangle< numeric_type >::text_form | ( | ) | const |
Prints out the contents of the rectangle.
Definition at line 234 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
Referenced by main().
| bool geometric::rectangle< numeric_type >::from_text | ( | const istring & | text | ) |
Returns true if the "text" is parsed into this rectangle.
Definition at line 241 of file rectangle.cpp.
References istring::convert(), crop_non_numeric(), crop_numeric(), numeric_specifier(), geometric::rectangle< numeric_type >::vertex_1(), and geometric::rectangle< numeric_type >::vertex_2().
Referenced by tiny_shell::Create(), EVT_COMMAND(), and main().
| point< numeric_type > geometric::rectangle< numeric_type >::vertex_1 | ( | ) | const |
Definition at line 35 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1.
Referenced by geometric::rectangle< numeric_type >::bottom_left(), geometric::rectangle< numeric_type >::bottom_right(), geometric::rectangle< numeric_type >::from_text(), and geometric::rectangle< numeric_type >::top_left().
| point< numeric_type > geometric::rectangle< numeric_type >::vertex_2 | ( | ) | const |
Definition at line 39 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_2.
Referenced by geometric::rectangle< numeric_type >::bottom_right(), geometric::rectangle< numeric_type >::from_text(), geometric::rectangle< numeric_type >::top_left(), and geometric::rectangle< numeric_type >::top_right().
| void geometric::rectangle< numeric_type >::vertex_1 | ( | const point< numeric_type > & | to_set | ) |
Definition at line 43 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1.
| void geometric::rectangle< numeric_type >::vertex_2 | ( | const point< numeric_type > & | to_set | ) |
Definition at line 47 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_2.
| void geometric::rectangle< contents >::pack | ( | byte_array & | packed_form | ) | const [virtual] |
Creates a packed form of the packable object in "packed_form".
This must append to the data in "packed_form" rather than clearing prior contents.
Implements packable.
Definition at line 164 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
Referenced by bubble::pack().
| bool geometric::rectangle< contents >::unpack | ( | byte_array & | packed_form | ) | [virtual] |
Restores the packable from the "packed_form".
This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.
Implements packable.
Definition at line 171 of file rectangle.cpp.
References geometric::rectangle< numeric_type >::_vertex_1, and geometric::rectangle< numeric_type >::_vertex_2.
Referenced by bubble::unpack().
point<numeric_type> geometric::rectangle< numeric_type >::_vertex_1 [protected] |
Definition at line 123 of file rectangle.h.
Referenced by geometric::rectangle< numeric_type >::center(), geometric::rectangle< numeric_type >::encompass(), geometric::rectangle< numeric_type >::height(), geometric::rectangle< numeric_type >::inside(), geometric::rectangle< numeric_type >::maximum_x(), geometric::rectangle< numeric_type >::maximum_y(), geometric::rectangle< numeric_type >::minimum_x(), geometric::rectangle< numeric_type >::minimum_y(), geometric::rectangle< numeric_type >::operator+=(), geometric::rectangle< numeric_type >::operator-=(), geometric::rectangle< numeric_type >::order(), geometric::rectangle< numeric_type >::pack(), geometric::rectangle< numeric_type >::text_form(), geometric::rectangle< numeric_type >::unpack(), geometric::rectangle< numeric_type >::vertex_1(), and geometric::rectangle< numeric_type >::width().
point<numeric_type> geometric::rectangle< numeric_type >::_vertex_2 [protected] |
Definition at line 124 of file rectangle.h.
Referenced by geometric::rectangle< numeric_type >::center(), geometric::rectangle< numeric_type >::encompass(), geometric::rectangle< numeric_type >::height(), geometric::rectangle< numeric_type >::inside(), geometric::rectangle< numeric_type >::maximum_x(), geometric::rectangle< numeric_type >::maximum_y(), geometric::rectangle< numeric_type >::minimum_x(), geometric::rectangle< numeric_type >::minimum_y(), geometric::rectangle< numeric_type >::operator+=(), geometric::rectangle< numeric_type >::operator-=(), geometric::rectangle< numeric_type >::order(), geometric::rectangle< numeric_type >::pack(), geometric::rectangle< numeric_type >::text_form(), geometric::rectangle< numeric_type >::unpack(), geometric::rectangle< numeric_type >::vertex_2(), and geometric::rectangle< numeric_type >::width().
1.5.1