|
G3D::Rect2D Class ReferenceIf you are using this class for pixel rectangles, keep in mind that the last pixel you can draw to is at x0() + width() - 1.
More...
#include <Rect2D.h>
List of all members.
|
Public Member Functions |
| float | area () const |
| Rect2D | border (float delta) const |
| Vector2 | center () const |
| template<class T> |
| void | clip (const Array< T > &inPoly, Array< T > &outPoly) const |
| bool | contains (const Rect2D &r) const |
| bool | contains (const Vector2 &v) const |
| Vector2 | corner (int i) const |
| float | height () const |
| Rect2D | intersect (const Rect2D &other) const |
| bool | intersects (const Rect2D &r) const |
| bool | intersectsOrTouches (const Rect2D &r) const |
| Rect2D | largestCenteredSubRect (float ww, float hh) const |
| Rect2D | lerp (const Rect2D &other, float alpha) const |
| Rect2D | operator * (float s) const |
| bool | operator!= (const Rect2D &other) const |
| Rect2D | operator+ (const Vector2 &v) const |
| Rect2D | operator- (const Vector2 &v) const |
| Rect2D | operator/ (float s) const |
| bool | operator== (const Rect2D &other) const |
| | Rect2D (const Rect2D &a, const Rect2D &b) |
| | Rect2D (const Vector2 &wh) |
| | Rect2D () |
| Vector2 | wh () const |
| float | width () const |
| float | x0 () const |
| Vector2 | x0y0 () const |
| Vector2 | x0y1 () const |
| float | x1 () const |
| Vector2 | x1y0 () const |
| Vector2 | x1y1 () const |
| float | y0 () const |
| float | y1 () const |
Static Public Member Functions |
| static Rect2D | xywh (const Vector2 &v, const Vector2 &w) |
| static Rect2D | xywh (float x, float y, float w, float h) |
| static Rect2D | xyxy (const Vector2 &v0, const Vector2 &v1) |
| static Rect2D | xyxy (float x0, float y0, float x1, float y1) |
Detailed Description
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.
Constructor & Destructor Documentation
| G3D::Rect2D::Rect2D |
( |
|
) |
[inline] |
| G3D::Rect2D::Rect2D |
( |
const Vector2 & |
wh |
) |
[inline] |
Creates a rectangle at 0,0 with the given width and height.
| G3D::Rect2D::Rect2D |
( |
const Rect2D & |
a, |
|
|
const Rect2D & |
b | |
|
) |
| | [inline] |
Computes a rectangle that contains both a and b.
Member Function Documentation
| float G3D::Rect2D::area |
( |
|
) |
const [inline] |
| Rect2D G3D::Rect2D::border |
( |
float |
delta |
) |
const [inline] |
Returns a new Rect2D that is bigger/smaller by the specified amount (negative is shrink.
)
| Vector2 G3D::Rect2D::center |
( |
|
) |
const [inline] |
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.
| bool G3D::Rect2D::contains |
( |
const Rect2D & |
r |
) |
const [inline] |
| bool G3D::Rect2D::contains |
( |
const Vector2 & |
v |
) |
const [inline] |
| Vector2 G3D::Rect2D::corner |
( |
int |
i |
) |
const [inline] |
Returns the corners in the order: (min,min), (max,min), (max,max), (min,max).
| float G3D::Rect2D::height |
( |
|
) |
const [inline] |
| Rect2D G3D::Rect2D::intersect |
( |
const Rect2D & |
other |
) |
const [inline] |
Returns the overlap region between the two rectangles.
This may have zero area if they do not intersect. See the two-Rect2D constructor for a way to compute a union-like rectangle.
| bool G3D::Rect2D::intersects |
( |
const Rect2D & |
r |
) |
const [inline] |
True if there is non-zero area to the intersection between this and r.
Note that two rectangles that are adjacent do not intersect because there is zero area to the overlap, even though one of them "contains" the corners of the other.
| bool G3D::Rect2D::intersectsOrTouches |
( |
const Rect2D & |
r |
) |
const [inline] |
Like intersection, but counts the adjacent case as touching.
| Rect2D G3D::Rect2D::largestCenteredSubRect |
( |
float |
ww, |
|
|
float |
hh | |
|
) |
| | const [inline] |
Returns the largest, centered Rect2D that can fit inside this while maintaining the aspect ratio of x:y.
Convenient for displaying images in odd-shaped windows.
| Rect2D G3D::Rect2D::lerp |
( |
const Rect2D & |
other, |
|
|
float |
alpha | |
|
) |
| | const [inline] |
| Rect2D G3D::Rect2D::operator * |
( |
float |
s |
) |
const [inline] |
| bool G3D::Rect2D::operator!= |
( |
const Rect2D & |
other |
) |
const [inline] |
| Rect2D G3D::Rect2D::operator+ |
( |
const Vector2 & |
v |
) |
const [inline] |
| Rect2D G3D::Rect2D::operator- |
( |
const Vector2 & |
v |
) |
const [inline] |
| Rect2D G3D::Rect2D::operator/ |
( |
float |
s |
) |
const [inline] |
| bool G3D::Rect2D::operator== |
( |
const Rect2D & |
other |
) |
const [inline] |
| Vector2 G3D::Rect2D::wh |
( |
|
) |
const [inline] |
| float G3D::Rect2D::width |
( |
|
) |
const [inline] |
| float G3D::Rect2D::x0 |
( |
|
) |
const [inline] |
| Vector2 G3D::Rect2D::x0y0 |
( |
|
) |
const [inline] |
| Vector2 G3D::Rect2D::x0y1 |
( |
|
) |
const [inline] |
| float G3D::Rect2D::x1 |
( |
|
) |
const [inline] |
| Vector2 G3D::Rect2D::x1y0 |
( |
|
) |
const [inline] |
| Vector2 G3D::Rect2D::x1y1 |
( |
|
) |
const [inline] |
| static Rect2D G3D::Rect2D::xywh |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
w, |
|
|
float |
h | |
|
) |
| | [inline, static] |
| static Rect2D G3D::Rect2D::xyxy |
( |
float |
x0, |
|
|
float |
y0, |
|
|
float |
x1, |
|
|
float |
y1 | |
|
) |
| | [inline, static] |
| float G3D::Rect2D::y0 |
( |
|
) |
const [inline] |
| float G3D::Rect2D::y1 |
( |
|
) |
const [inline] |
The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by
1.5.2
Hosted by
| |