|
libvisual
0.5.0
|
Class describing an axis-aligned rectangle. More...
#include <libvisual/lv_rectangle.h>
Public Member Functions | |
| Rect () | |
| Creates a new empty Rect. | |
| Rect (int x_, int y_, int width_, int height_) | |
| Creates a new Rect. More... | |
| Rect (int width_, int height_) | |
| Creates a new Rect of the given dimensions. More... | |
| void | set (int x_, int y_, int width_, int height_) |
| Sets rectangle extents. More... | |
| bool | empty () const |
| Checks if this rectangle has a non-zero area. More... | |
| bool | contains (int x_, int y_) const |
| Tests if a given point falls within this rectangle. More... | |
| bool | contains (Rect const &r) const |
| Tests if this rectangle completely contains with another. More... | |
| bool | intersects (Rect const &r) const |
| tests if this rectangle intersects with another More... | |
| Rect | clip (Rect const &r) const |
| Clips a rectangle to this rectangle. More... | |
| void | normalize () |
| Normalizes this rectangle to the origin. More... | |
| void | normalize_to (Rect const &r) |
| Normalizes this rectangle to another. More... | |
| void | denormalize_point (float fx, float fy, int32_t &x_, int32_t &y_) const |
| Transforms a point with relative coordinates in [(0,0), (1,1)] to absolute positions in this rectangle. More... | |
| void | denormalize_points (float const *fxlist, float const *fylist, int32_t *xlist, int32_t *ylist, unsigned int size) const |
| A fast array version of denormalize_point(). More... | |
| void | denormalize_point_neg (float fx, float fy, int32_t &x_, int32_t &y_) const |
| Transform a point with relative coordinates in [(-1,-1), (1,1)] to absolute positions in this rectangle. More... | |
| void | denormalize_points_neg (float const *fxlist, float const *fylist, int32_t *xlist, int32_t *ylist, unsigned int size) const |
| A fast array version of denormalize_point_neg() More... | |
Public Attributes | |
| int | x |
| int | y |
| int | width |
| int | height |
Class describing an axis-aligned rectangle.
Definition at line 39 of file lv_rectangle.h.
|
inline |
Creates a new Rect.
| x | X-coordinate of upper-left corner |
| y | Y-coordinate of upper-left corner |
| width | Width of rectangle |
| height | Height of rectangle |
Definition at line 63 of file lv_rectangle.h.
|
inline |
Creates a new Rect of the given dimensions.
| width | Width of rectangle |
| height | Height of rectangle |
Definition at line 73 of file lv_rectangle.h.
Clips a rectangle to this rectangle.
| r | rectangle to clip |
Definition at line 65 of file lv_rectangle.cpp.
|
inline |
Tests if a given point falls within this rectangle.
| x | x position of point |
| y | y position of point |
Definition at line 109 of file lv_rectangle.h.
| bool LV::Rect::contains | ( | Rect const & | r | ) | const |
Tests if this rectangle completely contains with another.
| r | rectangle to test containment |
Definition at line 48 of file lv_rectangle.cpp.
|
inline |
Transforms a point with relative coordinates in [(0,0), (1,1)] to absolute positions in this rectangle.
(0,0) and (1,1) are respectively mapped to the top-left and bottom-right corners.
| fx | Normalized X coordinate of point |
| fy | Normalized Y coordinate of point |
| x | Integer variable to store the absolute X coordinate |
| y | Integer variable to store the absolute Y coordinate |
Definition at line 179 of file lv_rectangle.h.
|
inline |
Transform a point with relative coordinates in [(-1,-1), (1,1)] to absolute positions in this rectangle.
(-1,-1) and (1,1) are respectively mapped to the top-left and bottom-right corners.
| fx | Normalized X coordinate of point |
| fy | Normalized Y coordinate of point |
| x | Integer variable to store the absolute X coordinate |
| y | Integer variable to store the absolute Y coordinate |
Definition at line 216 of file lv_rectangle.h.
| void LV::Rect::denormalize_points | ( | float const * | fxlist, |
| float const * | fylist, | ||
| int32_t * | xlist, | ||
| int32_t * | ylist, | ||
| unsigned int | size | ||
| ) | const |
A fast array version of denormalize_point().
| fxlist | input array of x coordinates, each in [0.0, 1.0] |
| fylist | input array of y coordinates, each in [0.0, 1.0] |
| xlist | output array of x coordinates |
| ylist | output array of y coordinates |
| size | number of points |
Definition at line 95 of file lv_rectangle.cpp.
| void LV::Rect::denormalize_points_neg | ( | float const * | fxlist, |
| float const * | fylist, | ||
| int32_t * | xlist, | ||
| int32_t * | ylist, | ||
| unsigned int | size | ||
| ) | const |
A fast array version of denormalize_point_neg()
| fxlist | input array of x coordinates, each in [-1.0, 1.0] |
| fylist | input array of y coordinates, each in [-1,0, 1.0] |
| xlist | output array of x coordinates |
| ylist | output array of y coordinates |
| size | number of points |
Definition at line 107 of file lv_rectangle.cpp.
|
inline |
Checks if this rectangle has a non-zero area.
Definition at line 96 of file lv_rectangle.h.
| bool LV::Rect::intersects | ( | Rect const & | r | ) | const |
tests if this rectangle intersects with another
| r | rectangle to test intersection with |
Definition at line 31 of file lv_rectangle.cpp.
Referenced by clip().
|
inline |
Normalizes this rectangle to the origin.
The top-corner will be set to (0, 0)
| src | rectangle to normalize to |
Definition at line 148 of file lv_rectangle.h.
|
inline |
Normalizes this rectangle to another.
The top-corner will be set to that of the given rectangle.
| src | rectangle to normalize to |
Definition at line 159 of file lv_rectangle.h.
|
inline |
Sets rectangle extents.
| x | X-coordinate of upper-left corner |
| y | Y-coordinate of upper-left corner |
| width | Width of rectangle |
| height | Height of rectangle |
Definition at line 85 of file lv_rectangle.h.