Generic container to store any information in 3D (features, photos, ...) More...
#include <Container3d.h>
Classes | |
class | Iterator |
Iterator for going through the items in Container3d in the specified order. More... | |
Public Types | |
typedef std::pair< CvPoint3D32f, T > | node_type |
node_type for storing data. 3D-position is paired with the data content. More... | |
Public Member Functions | |
void | Add (const CvPoint3D32f &_pos, const T &_data) |
Add _data in the container and associate it with 3D position _pos. More... | |
Iterator | begin () |
Provides an iterator pointing to the beginning of the limited/sorted 3D content. More... | |
void | Clear () |
Clear the container. More... | |
Iterator | end () |
Provides an iterator pointing to the end of the limited/sorted 3D content. More... | |
void | Erase (size_t index) |
Erase item in the container. More... | |
size_t | GetIndex (Iterator &iter) |
Get absolute reference usable with operator[]() based on the iterator. More... | |
size_t | GetIndex (T *p) |
Get absolute reference usable with operator[]() based on the content. More... | |
template<typename Test > | |
int | Limit (Test test) |
Limit the search space with external limitation. More... | |
node_type & | operator[] (size_t index) |
Instead of Iterator we can use also absolute references for data with operator[]() More... | |
void | ResetSearchSpace () |
Reset the search space to contain whole data. More... | |
size_t | size () const |
Get number of items that can be referenced using operator[]() More... | |
template<typename Compare > | |
int | Sort (Compare comp) |
Sort using external Compare method. More... | |
Protected Attributes | |
std::vector< node_type > | data |
the actual data in using node_type: pair<CvPoint3D32f, T> More... | |
std::vector< size_t > | search_space |
Possibly limited set of indices for data in somehow "optimal" search order. More... | |
Generic container to store any information in 3D (features, photos, ...)
You can store any information in 3D using this container. Each element in the container has an unique id that it can be referenced with using operator[](). The indices are from 0 to size(). You can find specific index using GetIndex(Iterator &iter) or GetIndex(T *p) .
In addition the Container3d contains also a 'search space' that can be iterated through using begin() and end(). This 'search space' can be limited using Limit() , sorted using Sort() and reseted using ResetSearchSpace(). You specify what to limit/sort using specified functors. In ALVAR there exists functors Container3dLimitDist , Container3dSortSize and Container3dSortDist . But you can quite well make your own versions (see example below).
The implementation is optimized for a situation where there are a lot of searches between every time the search space is limited/ordered. This is the reason we use vector containers internally. The idea is that later we will improve the class by providing more ways for limiting and sorting the search space; for example Frustum culling.
Usage:
Definition at line 40 of file Container3d.h.
typedef std::pair<CvPoint3D32f, T> alvar::Container3d< T >::node_type |
node_type for storing data. 3D-position is paired with the data content.
Definition at line 170 of file Container3d.h.
|
inline |
Add _data in the container and associate it with 3D position _pos.
Definition at line 179 of file Container3d.h.
|
inline |
Provides an iterator pointing to the beginning of the limited/sorted 3D content.
Definition at line 248 of file Container3d.h.
|
inline |
Clear the container.
Definition at line 184 of file Container3d.h.
|
inline |
Provides an iterator pointing to the end of the limited/sorted 3D content.
Definition at line 253 of file Container3d.h.
|
inline |
Erase item in the container.
Definition at line 197 of file Container3d.h.
|
inline |
Get absolute reference usable with operator[]() based on the iterator.
Definition at line 261 of file Container3d.h.
|
inline |
Get absolute reference usable with operator[]() based on the content.
Definition at line 271 of file Container3d.h.
Limit the search space with external limitation.
Definition at line 213 of file Container3d.h.
|
inline |
Instead of Iterator we can use also absolute references for data with operator[]()
Definition at line 266 of file Container3d.h.
|
inline |
Reset the search space to contain whole data.
Definition at line 189 of file Container3d.h.
|
inline |
Get number of items that can be referenced using operator[]()
Definition at line 258 of file Container3d.h.
|
inline |
Sort using external Compare method.
Definition at line 206 of file Container3d.h.
|
protected |
the actual data in using node_type: pair<CvPoint3D32f, T>
Definition at line 173 of file Container3d.h.
|
protected |
Possibly limited set of indices for data in somehow "optimal" search order.
Definition at line 175 of file Container3d.h.