PARP Research Group Universidad de Murcia


QV2DMap Class Reference
[Math functionality]

Fast 2D nearest neigbour access data container. More...

#include <QV2DMap>

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

QV2DMap::QV2DMap ( const QList< QPointF > &  points = QList<QPointF>()  ) 

Default constructor.

Parameters:
points Points to insert in the container.

Definition at line 42 of file qv2dmap.cpp.


Member Function Documentation

void QV2DMap::add ( const QPointF &  point  ) 

Adds a 2D point to the container.

Parameters:
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.

Returns:
If the container is empty, return the default value for QPointF. Else returns the point which is closer to the given one.

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.

Returns:
If the container holds n points or less, the return value is a list containing those points. Else, returns the n points contained which are closer to the given one.

Definition at line 96 of file qv2dmap.cpp.


The documentation for this class was generated from the following files:



QVision framework. PARP research group. Copyright © 2007, 2008, 2009, 2010, 2011.