TrinityCore
|
#include <Rect2D.h>
Static Public Member Functions | |
static const Rect2D & | empty () |
static Rect2D | xyxy (float x0, float y0, float x1, float y1) |
static Rect2D | xyxy (const Point2 &v0, const Point2 &v1) |
static Rect2D | xywh (float x, float y, float w, float h) |
static Rect2D | xywh (const Point2 &v, const Vector2 &w) |
static Rect2D | inf () |
Private Member Functions | |
Rect2D (bool) | |
Static Private Member Functions | |
template<class T > | |
static bool | clipSide2D (const float p, bool clipGreater, int axis, const Array< T > &inPoly, Array< T > &outPoly) |
Private Attributes | |
Point2 | min |
Point2 | max |
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.
|
inlineprivate |
any | Must either Rect2D::xywh(#, #, #, #) or Rect2D::xyxy(#, #, #, #) |
|
inline |
Creates the empty set rectangle.
Creates a rectangle at 0,0 with the given width and height
Computes a rectangle that contains both a and b. Note that even if or has zero area, its origin will be included.
|
inline |
|
inline |
|
inline |
|
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.
|
inlinestaticprivate |
Returns true if the whole polygon is clipped.
p | Value of the point |
axis | Index [0 or 1] of the axis to clip along? |
clipGreater | Are we clipping greater than or less than the line? |
inPoly | Polygon being clipped |
outPoly | The clipped polygon |
|
inline |
Returns the corners in the order: (min,min), (max,min), (max,max), (min,max).
void G3D::Rect2D::deserialize | ( | class BinaryInput & | b | ) |
|
inline |
Returns a new Rect2D that is bigger/smaller by the specified amount (negative is shrink.)
|
inline |
|
inline |
|
inlinestatic |
Constructs a Rect2D with infinite boundaries. Use isFinite() to test either min or max.
Returns the overlap region between the two rectangles. This may have zero area if they do not intersect. See the two-Rect2D constructor and merge() for a way to compute a union-like rectangle.
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.
Like intersection, but counts the adjacent case as touching.
|
inline |
Returns true if this is the empty set, which is distinct from a zero-area rectangle.
|
inline |
|
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.
|
inline |
|
inline |
|
inline |
Uniformly random point on the interior.
void G3D::Rect2D::serialize | ( | class BinaryOutput & | b | ) | const |
Any G3D::Rect2D::toAny | ( | ) | const |
|
inline |
Width and height
|
inline |
|
inline |
|
inline |
Min, min corner
|
inline |
|
inline |
|
inline |
|
inline |
Max,max corner
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
private |
|
private |