![]() |
Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
|
#include <QuadTree.hpp>
Classes | |
| class | Level |
Public Member Functions | |
| QuadTree (Application *app, uvec2 const &size, uint const maxDistance) | |
| void | resize (uvec2 const &size) |
| template<typename tFnc > | |
| void | fill (tFnc readIds) |
| bool | findNear (uvec2 const &pos, OUT id_t &foundId, OUT uvec2 &foundPos, OUT float &foundDistance) |
| void | maxDistance (uint const distance) |
| uint const | maxDistance () const |
Private Types | |
| typedef Level< id_t > | DataLevel |
| typedef Level< BOOLEAN > | MidLevel |
Private Member Functions | |
| void | updateLayersParallel () |
| void | updateLayersSerial () |
| void | updateLayersBaseCell (uint const layer, uint const x, uint const y) |
| template<typename TBaseLayer , typename TCurrentLayer > | |
| void | updateLayerArea (TBaseLayer base, TCurrentLayer current, uint const offset_x, uint const offset_y, uint size) |
| template<typename TBaseLayer , typename TCurrentLayer > | |
| void | updateLayerCell (TBaseLayer base, TCurrentLayer current, uint const x, uint const y) |
Private Attributes | |
| Application * | m_app |
| DataLevel | m_data |
| vector< MidLevel > | m_levels |
| uint | m_maxDistance |
| array< auto_reset_event, 4 > | m_updateLayersParallelMutex |
QuadTree hosts a quadtree-structure where the base-layer represents the data. It creates an image-pyramid where the next levels value is 0 for non-existing data underneath it, and 1 for existing data.
Definition at line 9 of file QuadTree.hpp.
Definition at line 107 of file QuadTree.hpp.
Definition at line 108 of file QuadTree.hpp.
| QuadTree | ( | Application * | app, |
| uvec2 const & | size, | ||
| uint const | maxDistance | ||
| ) |
Constructs a QuadTree-object
| app | The global application object |
| size | The data-layer-size |
| maxDistance | The max-distance in which to look for pickable objects |
Definition at line 3 of file QuadTree.cpp.
|
inline |
Fills the data-layer with values and rebuilds the image-pyramid.
| readIds | A function that is executed to fill the data-layer. It is supposed to take 1 parameter of the type id_t*. |
Definition at line 138 of file QuadTree.hpp.
| bool findNear | ( | uvec2 const & | pos, |
| OUT id_t & | foundId, | ||
| OUT uvec2 & | foundPos, | ||
| OUT float & | foundDistance | ||
| ) |
Finds the nearest object to the given position.
| pos | The position at which to look |
| foundId | The found id |
| foundPos | The found position |
| foundDistance | The found distance |
Definition at line 35 of file QuadTree.cpp.
| void maxDistance | ( | uint const | distance | ) |
Accessor to the max-distance in which to look for pickable objects
| distance | The new max-distance in which to look for pickable objects |
Definition at line 159 of file QuadTree.cpp.
| uint const maxDistance | ( | ) | const |
Accessor to the max-distance in which to look for pickable objects
Definition at line 163 of file QuadTree.cpp.
| void resize | ( | uvec2 const & | size | ) |
Resizes the data-layer of the quad-tree and extends the image-pyramid by some layers if necessary.
| size | The new data-layer-size. |
Definition at line 14 of file QuadTree.cpp.
|
inlineprivate |
Update an area of a layer based on the next larger layer.
| base | The next larger layer |
| current | The current layer |
| offset_x | The areas left border |
| offset_y | The areas top border |
| size | The size of the area (in x and y) |
Definition at line 204 of file QuadTree.hpp.
|
inlineprivate |
Update a single cell of a layer based on the next larger layer
| base | The next larger layer |
| current | The current layer |
| x | The x-coordinate of the cell |
| y | The y-coordinate of the cell |
Definition at line 219 of file QuadTree.hpp.
|
private |
Updates the image-pyramid "under" one cell.
| layer | The layer of this cell |
| x | The x-coordinate of this cell (in the layer) |
| y | The y-coordinate of this cell (in the layer) |
Definition at line 169 of file QuadTree.cpp.
|
private |
Updates the image-pyramid multi-threaded.
Definition at line 193 of file QuadTree.cpp.
|
private |
Updates the image-pyramid single-threaded.
Definition at line 207 of file QuadTree.cpp.
|
private |
The global application
Definition at line 111 of file QuadTree.hpp.
|
private |
The data-layer
Definition at line 112 of file QuadTree.hpp.
|
private |
The image-pyramid
Definition at line 113 of file QuadTree.hpp.
|
private |
The max-distance in which to look for pickable objects
Definition at line 114 of file QuadTree.hpp.
|
private |
Synchronization structures for parallel processing
Definition at line 115 of file QuadTree.hpp.
1.8.7