|
| | Rect2D (const Any &any) |
| |
| | Rect2D (const Rect2D &r) |
| |
| | Rect2D () |
| | Creates the empty set rectangle. More...
|
| |
| | Rect2D (const Vector2 &wh) |
| | Creates a rectangle at 0,0 with the given width and height. More...
|
| |
| | Rect2D (const Rect2D &a, const Rect2D &b) |
| | Computes a rectangle that contains both a and b. More...
|
| |
| float | area () const |
| |
| Rect2D | border (float delta) const |
| |
| Point2 | center () const |
| |
| template<class T > |
| void | clip (const Array< T > &inPoly, Array< T > &outPoly) const |
| |
Clips so that the rightmost point of the outPoly is at rect.x1 (e.g. More...
|
| |
| bool | contains (const Point2 &v) const |
| |
| bool | contains (const Rect2D &r) const |
| |
| Point2 | corner (int i) const |
| | Returns the corners in the order: (min,min), (max,min), (max,max), (min,max). More...
|
| |
| void | deserialize (class BinaryInput &b) |
| |
| Rect2D | expand (float delta) const |
| | Returns a new Rect2D that is bigger/smaller by the specified amount (negative is shrink.) More...
|
| |
| Vector2 | extent () const |
| |
| float | height () const |
| |
| Rect2D | intersect (const Rect2D &other) const |
| |
Returns the overlap region between the two rectangles. More...
|
| |
| bool | intersects (const Rect2D &r) const |
| | True if there is non-zero area to the intersection between this and r. More...
|
| |
| bool | intersectsOrTouches (const Rect2D &r) const |
| | Like intersection, but counts the adjacent case as touching. More...
|
| |
| bool | isEmpty () const |
| | Returns true if this is the empty set, which is distinct from a zero-area rectangle. More...
|
| |
| bool | isFinite () const |
| |
| Rect2D | largestCenteredSubRect (float ww, float hh) const |
| | Returns the largest, centered Rect2D that can fit inside this while maintaining the aspect ratio of x:y. More...
|
| |
| Rect2D | lerp (const Rect2D &other, float alpha) const |
| |
| void | merge (const Rect2D &other) |
| |
| bool | operator!= (const Rect2D &other) const |
| |
| Rect2D | operator* (float s) const |
| |
| Rect2D | operator* (const Vector2 &s) const |
| |
| Rect2D | operator+ (const Vector2 &v) const |
| |
| Rect2D | operator- (const Vector2 &v) const |
| |
| Rect2D | operator/ (float s) const |
| |
| Rect2D | operator/ (const Vector2 &s) const |
| |
| bool | operator== (const Rect2D &other) const |
| |
| Point2 | randomPoint () const |
| | Uniformly random point on the interior. More...
|
| |
| void | serialize (class BinaryOutput &b) const |
| |
| Any | toAny () const |
| | Converts the Rect2D to an Any. More...
|
| |
| Vector2 | wh () const |
| | Width and height. More...
|
| |
| float | width () const |
| |
| float | x0 () const |
| |
| Point2 | x0y0 () const |
| | Min, min corner. More...
|
| |
| Point2 | x0y1 () const |
| |
| float | x1 () const |
| |
| Point2 | x1y0 () const |
| |
| Point2 | x1y1 () const |
| | Max,max corner. More...
|
| |
| float | y0 () const |
| |
| float | y1 () const |
| |
If you are using this class for pixel rectangles, keep in mind that the last pixel you can draw to is at x0() + width() - 1.
template<class T >
| void G3D::Rect2D::clip |
( |
const Array< T > & |
inPoly, |
|
|
Array< T > & |
outPoly |
|
) |
| const |
|
inline |
Clips so that the rightmost point of the outPoly is at rect.x1 (e.g.
a 800x600 window produces rightmost point 799, not 800). The results are suitable for pixel rendering if iRounded. Templated so that it will work for Vector2,3,4 (the z and w components are interpolated linearly). The template parameter must define T.lerp and contain x and y components.
If the entire polygon is clipped by a single side, the result will be empty. The result might also have zero area but not be empty.