PARP Research Group | Universidad de Murcia |
QV2DMap Class Reference
|
Public Member Functions | |
void | add (const QPointF &point) |
Adds a 2D point to the container. | |
QV2DMap (const QList< QPointF > &points=QList< QPointF >()) | |
Default constructor. | |
QPointF | getClosestPoint (const QPointF &point) const |
Get the closest point to a given one from the container. | |
QList< QPointF > | getClosestPoints (const QPointF &point, const int n) const |
Get the closest points to a given one from the container. |
Fast 2D nearest neigbour access data container.
This class represents a container for 2D points on the real plane.
Such containers are created from a list of QPointF objects, or initialized manually, inserting the points with the add method:
QList<QPointF> points; points.append(QPointF(10.7,20.1)); points.append(QPointF(15.5,9.2)); [...] QV2DMap pointMap1(points), pointMap2; pointMap2.add(QPointF(34.7, 12.9)); pointMap2.add(QPointF(99.0, 1.2)); [...]
The method getClosestPoints can be used to obtain the points registered in the container, which are closer to a given point.
Definition at line 61 of file qv2dmap.h.
QV2DMap::QV2DMap | ( | const QList< QPointF > & | points = QList<QPointF>() |
) |
Default constructor.
points | Points to insert in the container. |
Definition at line 42 of file qv2dmap.cpp.
void QV2DMap::add | ( | const QPointF & | point | ) |
Adds a 2D point to the container.
point | Point to add to the container. |
Definition at line 37 of file qv2dmap.cpp.
Referenced by QV2DMap().
QPointF QV2DMap::getClosestPoint | ( | const QPointF & | point | ) | const |
Get the closest point to a given one from the container.
Definition at line 48 of file qv2dmap.cpp.
QList< QPointF > QV2DMap::getClosestPoints | ( | const QPointF & | point, | |
const int | n | |||
) | const |
Get the closest points to a given one from the container.
Definition at line 96 of file qv2dmap.cpp.