Access to the grid elements. More...
#include <Radiant/Grid.hpp>
Public Types | |
| typedef const T * | const_iterator |
| Const iterator for the grid. | |
| typedef T * | iterator |
| Iterator for the grid. | |
| typedef T | value_type |
| Type of grid data. | |
Public Member Functions | |
| template<typename S > | |
| void | copyFast (const S &that) |
| Copies data from that to this using memcpy. More... | |
| T * | data () |
| Returns a pointer to the data area. More... | |
| const T * | data () const |
| Returns a const pointer to the data area. More... | |
| void | fill (const T &val, int xlow, int ylow, int width, int height) |
| Fills the grid with the given value. More... | |
| void | fillCircle (const T &val, Nimble::Vector2 center, float radius) |
| Fills a circle in the grid with the given value. More... | |
| Nimble::Vector2i | geometry () const |
| Returns the dimensions of the grid. More... | |
| T & | get (unsigned x, unsigned y) |
| Gets an element from the grid. More... | |
| const T & | get (unsigned x, unsigned y) const |
| Gets an element from the grid. More... | |
| T & | get (const Nimble::Vector2i &v) |
| Gets an element from the grid. More... | |
| const T & | get (const Nimble::Vector2i &v) const |
| Gets an element from the grid. More... | |
| T & | get (const Nimble::Vector2f &v) |
| Gets an element from the grid. More... | |
| T & | get (const Nimble::Vector2f &v) const |
| Gets an element from the grid. More... | |
| T & | getCyclic (int x, int y) |
| Gets an element from the grid. More... | |
| template<typename U > | |
| U | getInterpolated (const Nimble::Vector2f &v) const |
| Interpolates an element from the grid values. More... | |
| T | getInterpolated (const Nimble::Vector2f &v) const |
| Interpolates an element from the grid values. More... | |
| template<typename U > | |
| U | getInterpolatedSafe (const Nimble::Vector2f &v) const |
| Interpolates an element from the grid values. More... | |
| T | getInterpolatedSafe (const Nimble::Vector2f &v) const |
| Interpolates an element from the grid values. More... | |
| T & | getNearest (const Nimble::Vector2f &v) |
| Returns a reference to the grid element that is closest to the argument vector. More... | |
| T | getSafe (const Nimble::Vector2i &v) const |
| Safe getter for grid data. More... | |
| T | getSafe (int x, int y) const |
| Safe getter for grid data. More... | |
| GridT () | |
| Constructor. | |
| template<class S > | |
| GridT (S &that) | |
| Constructs a copy. More... | |
| GridT (T *data, unsigned w, unsigned h) | |
| Constructor that takes the elements from the data pointer, with given width and height. More... | |
| template<typename S > | |
| bool | hasIdenticalDimensions (const S &that) |
| Checks if the width and height of this and that are identical. More... | |
| unsigned | height () const |
| Returns the height (number of rows) of this object. More... | |
| bool | isInside (unsigned x, unsigned y) const |
| Checks if the given point is inside the grid. More... | |
| bool | isInside (const Nimble::Vector2i &v) const |
| Checks if the given point is inside the grid. More... | |
| bool | isInside (const Nimble::Vector2f &v) const |
| Checks if the given point is inside the grid. More... | |
| T * | line (int y) |
| Get line of the grid. More... | |
| const T * | line (int y) const |
| Get line of the grid. More... | |
| void | setAll (const T &val) |
| Sets all grid elements to the given value. More... | |
| unsigned | size () const |
| Number of elements. More... | |
| unsigned | sizeBytes () const |
| Number of bytes used. More... | |
| template<typename S > | |
| void | swap (S &that) |
| Swaps the contents between this grid, and the other grid. More... | |
| unsigned | width () const |
| Returns the width (number of columns) of this object. More... | |
| void | zero () |
| Writes zeroes over the memory buffer (using memset) | |
Access to the grid elements.
| T | Type of objects to store |
| Base | Base class of this object |
|
inline |
Constructs a copy.
| that | Object to copy |
| S | Type of object to copy |
|
inline |
Constructor that takes the elements from the data pointer, with given width and height.
| data | Grid data |
| w | Width of the grid |
| h | Height of the grid |
|
inline |
Copies data from that to this using memcpy.
| that | Grid to copy from |
| S | Type of object to copy |
|
inline |
Returns a pointer to the data area.
|
inline |
Returns a const pointer to the data area.
|
inline |
Fills the grid with the given value.
| val | Value to fill with |
| xlow | Start x-coordinate of area to fill |
| ylow | Start y-coordinate of area to fill |
| width | Width of area to fill |
| height | Height of area to fill |
|
inline |
Fills a circle in the grid with the given value.
| val | Value to fill with |
| center | The center point of the circle |
| radius | The radius of the circle |
|
inline |
Returns the dimensions of the grid.
|
inline |
Gets an element from the grid.
If the arguments are outside the grid area, then result is undefined. In certain debug builds, the program stops with an assertion, while on typical release builds the function will simply return invalid data.
| x | X-coordinate of element |
| y | Y-coordinate of element |
|
inline |
Gets an element from the grid.
If the arguments are outside the grid area, then result is undefined. In certain debug builds, the program stops with an assertion, while on typical release builds the function will simply return invalid data.
| x | X-coordinate of element |
| y | Y-coordinate of element |
|
inline |
Gets an element from the grid.
| v | Coordinate of element |
|
inline |
Gets an element from the grid.
| v | Coordinate of element |
|
inline |
Gets an element from the grid.
| v | Coordinate of element |
|
inline |
Gets an element from the grid.
| v | Coordinate of element |
|
inline |
Gets an element from the grid.
| x | X-coordinate of element |
| y | Y-coordinate of element |
|
inline |
Interpolates an element from the grid values.
This function requires that the grid template type can be multiplied from the right with a floating point number.
| v | Coordinate of element |
| U | Type of the result |
|
inline |
Interpolates an element from the grid values.
| v | Coordinate of element |
|
inline |
Interpolates an element from the grid values.
This function requires that the grid template type can be multiplied from the right with a floating point number. Ensures that the values read are inside grid.
| v | Coordinate of element |
| U | Type of returned objest |
|
inline |
Interpolates an element from the grid values.
| v | Coordinate of element |
|
inline |
Returns a reference to the grid element that is closest to the argument vector.
| v | Coordinate of element |
|
inline |
Safe getter for grid data.
If coordinates are invalid, this will return null element of T.
| v | Coordinate of element |
|
inline |
Safe getter for grid data.
If coordinates are invalid, this will return null element of T.
| x | X-coordinate of element |
| y | Y-coordinate of element |
|
inline |
Checks if the width and height of this and that are identical.
| that | Grid to compare with |
| S | Type of object to compare |
|
inline |
Returns the height (number of rows) of this object.
|
inline |
Checks if the given point is inside the grid.
| x | X-coordinate of point |
| y | Y-coordinate of point |
|
inline |
Checks if the given point is inside the grid.
| v | Point coordinate |
|
inline |
Checks if the given point is inside the grid.
| v | Point coordinate |
|
inline |
Get line of the grid.
| y | Line number |
|
inline |
Get line of the grid.
| y | Line number |
|
inline |
Sets all grid elements to the given value.
| val | Value to fill with |
|
inline |
Number of elements.
|
inline |
Number of bytes used.
|
inline |
Swaps the contents between this grid, and the other grid.
| that | Grid to swap with |
| S | Type of object to copy |
|
inline |
Returns the width (number of columns) of this object.