Class QAccelPlot::PointSpatialIndex¶
ClassList > QAccelPlot > PointSpatialIndex
Uniform-grid spatial index for nearest-point queries over large point sets. More...
#include <PointSpatialIndex.hpp>
Classes¶
| Type | Name |
|---|---|
| struct | Mapping Coordinate mapping applied before indexing. |
Public Functions¶
| Type | Name |
|---|---|
| void | build (const float * data, int pointCount, int stride, Mapping mapping) Rebuilds the index from pointCount points in__data using__stride floats per point. |
| void | build (const float * data, int pointCount, int stride=2) Rebuilds the index with the identity mapping, for linear axes. |
| void | clear () Removes all indexed points. |
| int | columnCount () const Returns the number of grid columns of the last build; 0 when no point is indexed. |
| bool | isEmpty () const Returns true when no valid point is indexed. |
| Mapping | mapping () const Returns the mapping used by the last build. |
| int | nearest (double x, double y, double radiusX, double radiusY) const Returns the index of the point nearest to ( x _,_y ) inside the ellipse with radii__radiusX and__radiusY , or -1 when none. All arguments are in mapped space. |
| int | rowCount () const Returns the number of grid rows of the last build; 0 when no point is indexed. |
| int | validPointCount () const Returns the number of indexed (valid) points. |
Public Static Functions¶
| Type | Name |
|---|---|
| bool | mapCoordinate (double value, bool logarithmic, double & mapped) Maps value for indexing. Returns false when the value cannot be indexed. |
| int | nearestByScan (const float * data, int pointCount, int stride, Mapping mapping, double x, double y, double radiusX, double radiusY) Returns what nearest() returns on an index built from the same points, without building one. |
Detailed Description¶
Points are read from a flat float array with a configurable stride whose first two components are x and y. Coordinates are indexed in mapped space: log10 of the value on logarithmic axes, the value itself otherwise, so a pixel radius converts to a constant mapped-space radius at any zoom level. Non-finite points, and non-positive points on logarithmic axes, are excluded.
Cells are stored in a compressed layout (cellStart_ offsets into one index array), which keeps a rebuild over a million points to a handful of allocations.
See also: PointCloud
Public Functions Documentation¶
function build¶
Rebuilds the index from pointCount points in__data using__stride floats per point.
void QAccelPlot::PointSpatialIndex::build (
const float * data,
int pointCount,
int stride,
Mapping mapping
)
function build¶
Rebuilds the index with the identity mapping, for linear axes.
A separate overload rather than a defaulted Mapping argument: a nested class's default member initializers are not usable in a default argument until the enclosing class is complete, which MSVC accepts but Clang and GCC reject.
function clear¶
Removes all indexed points.
function columnCount¶
Returns the number of grid columns of the last build; 0 when no point is indexed.
function isEmpty¶
Returns true when no valid point is indexed.
function mapping¶
Returns the mapping used by the last build.
function nearest¶
Returns the index of the point nearest to ( x _,_y ) inside the ellipse with radii__radiusX and__radiusY , or -1 when none. All arguments are in mapped space.
int QAccelPlot::PointSpatialIndex::nearest (
double x,
double y,
double radiusX,
double radiusY
) const
Distance is normalized by the radii, so an anisotropic pixel radius behaves like a circle on screen. Ties resolve to the highest index, the point drawn last.
function rowCount¶
Returns the number of grid rows of the last build; 0 when no point is indexed.
function validPointCount¶
Returns the number of indexed (valid) points.
Public Static Functions Documentation¶
function mapCoordinate¶
Maps value for indexing. Returnsfalse when the value cannot be indexed.
static bool QAccelPlot::PointSpatialIndex::mapCoordinate (
double value,
bool logarithmic,
double & mapped
)
function nearestByScan¶
Returns what nearest() returns on an index built from the same points, without building one.
static int QAccelPlot::PointSpatialIndex::nearestByScan (
const float * data,
int pointCount,
int stride,
Mapping mapping,
double x,
double y,
double radiusX,
double radiusY
)
Tests every point, so a call costs one pass over data. That is cheaper than a rebuild while the data is replaced after only a few queries.
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/series/PointSpatialIndex.hpp