Although they are represented in a canonical form by only two vertices, namely the lower left and the upper right vertex, we provide functions for ``accessing'' the other vertices as well. The vertices are returned in counterclockwise order.
Iso-oriented rectangles and bounding boxes are quite similar. The difference however is that bounding boxes have always double coordinates, whereas the coordinate type of an iso-oriented rectangle is chosen by the user.
| |||
introduces an iso-oriented rectangle r with diagonal
opposite vertices and . Note that the object is
brought in the canonical form.
| |||
| |||
introduces an iso-oriented rectangle r whose
minimal coordinate is the one of left, the
maximal coordinate is the one of right, the
minimal coordinate is the one of bottom, the
maximal coordinate is the one of top.
| |||
| |||
introduces an iso-oriented rectangle r with diagonal
opposite vertices (min_hx/hw, min_hy/hw) and
(max_hx/hw, max_hy/hw). Precondition: hw 0.
|
|
| |
Test for equality: two iso-oriented rectangles are equal, iff their lower left and their upper right vertices are equal. | ||
|
| |
Test for inequality. | ||
|
| returns the i'th vertex modulo 4 of r in counterclockwise order, starting with the lower left vertex. |
|
| |
returns vertex(i). | ||
|
| returns the lower left vertex of r (= vertex(0)). |
|
| returns the upper right vertex of r (= vertex(2)). |
|
| returns the coordinate of lower left vertex of r. |
|
| returns the coordinate of lower left vertex of r. |
|
| returns the coordinate of upper right vertex of r. |
|
| returns the coordinate of upper right vertex of r. |
|
| |
returns the 'th
Cartesian
coordinate of the
lower left vertex of r. Precondition: . | ||
|
| |
returns the 'th
Cartesian
coordinate of the
upper right vertex of r. Precondition: . |
|
| r is degenerate, if all vertices are collinear. |
|
| |
returns either ON_UNBOUNDED_SIDE, ON_BOUNDED_SIDE, or the constant ON_BOUNDARY, depending on where point is. | ||
|
| |
|
| |
|
|
|
| returns the area of r. |
|
| returns a bounding box containing r. |
| ||
| ||
returns the iso-oriented rectangle obtained by applying on
the lower left and the upper right corner of r. Precondition: The angle at a rotation must be a multiple of , otherwise the resulting rectangle does not have the same side length. Note that rotating about an arbitrary angle can even result in a degenerate iso-oriented rectangle. |