MIRA
|
This class creates a look up table (LUT) to calculate the minimum and maximum Euclidean distance between a point and cells that are arranged in a regular grid. More...
#include <geometry/DistanceLUT.h>
Classes | |
struct | CellDist |
A struct to store the minimal and maximal distance of the cell towards the center point. More... | |
class | Region |
Provides a view on a portion of the Distance LUT and can be obtained by calling DistanceLUT::getRegion(). More... | |
Public Types | |
typedef const CellDist * | iterator |
the class's iterator type More... | |
typedef boost::shared_ptr< CellDist > | CellDistArrayPtr |
typedef Base::Type | Type |
Public Member Functions | |
DistanceLUT () | |
Creates a DistanceLUT with a default width of 1000 and 5 subdivisions. More... | |
~DistanceLUT () | |
The destructor. More... | |
void | ensureRegion (const Rect2i ®ion) |
Can be called to ensure, that the specified region in the LUT is available and valid. More... | |
Region | getRegion (const Point2f &d, const Rect2i ®ion) |
This function returns a portion of the LUT with cells containing the min and max distance to the given point. More... | |
Static Public Member Functions | |
static Type & | instance () |
Returns a reference to the singleton instance. More... | |
static bool | isDestroyed () |
Returns true, if the singleton was already destroyed. More... | |
Static Protected Member Functions | |
static Type * | makeInstance () |
static void | destroyInstance (void) |
This class creates a look up table (LUT) to calculate the minimum and maximum Euclidean distance between a point and cells that are arranged in a regular grid.
The main goal of this structure is to fasten operations like occupancy mapping, where the distance between many occupancy grid maps cells and the origin of a range sensor need to be computed.
The LUT works as follows: It maintains an array of cells, that are arranged around a central point p. Each cell c_i has a size of 1x1 (in non-dimensional units). Moreover, for each cell the min and max distance to the central point is stored.
The central point p is located within the central cell of the array. To increase the precision, the central cell is subdivided into bins:
Both the size (width) of the cell array as well as the precision (subdivisions) can be specified in the createLUT() method, which pre-computes the LUT.
For a distance look-up the getRegion() method needs to be called. It returns a portion of the LUT containing all cells within a given region. Moreover, the location of the central point within the central cell must be specified. Since the dimension of each cell is 1x1, the point must be located within the interval [0,0]-[1,1]. Based on the location of the point the corresponding subdivision bin is selected and the region of the appropriate LUT is returned.
The region can be iterated using an iterator that is provided by the region. Each cell within the region finally contains the min and max distance to the specified central point.
typedef boost::shared_ptr<CellDist> CellDistArrayPtr |
|
inherited |
DistanceLUT | ( | ) |
Creates a DistanceLUT with a default width of 1000 and 5 subdivisions.
These default settings can be changed via createLUT().
~DistanceLUT | ( | ) |
The destructor.
void ensureRegion | ( | const Rect2i & | region | ) |
Can be called to ensure, that the specified region in the LUT is available and valid.
If the region is larger than the LUT that has been generated so far, the LUT will be reallocated and recomputed. This method is called within getRegion() automatically, but may be called beforehand to ensure, that the time consuming process of recomputing the LUT is completed.
[in] | region | : the region where the LUT should be calculated |
This function returns a portion of the LUT with cells containing the min and max distance to the given point.
The point d lies between [0,0] and [1,1]. The distances of the resulting LUT are returned relative to that point.
[in] | d | : the point within central cell. The range must be located between [0,0]...[1,1]. |
[in] | region | : the region where the LUT should be calculated |
|
inlinestaticinherited |
Returns a reference to the singleton instance.
XSingleton | If the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation). |
|
inlinestaticinherited |
Returns true, if the singleton was already destroyed.
Trying to access it will result in an exception.
|
inlinestaticprotectedinherited |
|
inlinestaticprotectedinherited |