Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::QueryPointIndex Class Reference

#include <query_point.hpp>

List of all members.


Detailed Description

A query point index is a collection of query points that are indexed to permit efficient range searching.

This is a simple wrapper for the CGAL KD-tree data structure.

Definition at line 148 of file query_point.hpp.

Public Member Functions

template<class QueryPointListenerType>  QueryPointIndex (const std::vector< Geometry::Point > &points, const std::vector< QueryPointListenerType * > &listeners)
 Constructor.

 QueryPointIndex (const Geometry::Rectangle &r, int rows, int cols)
 Constructs a query point index with a grid of query points in the interior of a rectangular window.

 QueryPointIndex (const QueryPointIndex &q1, const QueryPointIndex &q2)
 Constructs a query point containing the query points in both of the supplied indexes.

 ~QueryPointIndex ()
 Destructor.

void addListeners (QueryPointListenerFactory &factory)
 Adds a query point listener to every query point in this index.

template<class OutputIterator> void output (const Geometry::Rectangle &r, OutputIterator it) const
 Searches for all query points in this index that are in the closure of the supplied rectangle.

template<class UnaryFunction> void apply (const Geometry::Rectangle &r, UnaryFunction &f) const
 Searches for all query points in this index that are in the closure of the supplied rectangle.

template<class UnaryFunction> void applyToAll (UnaryFunction &f) const
 Applies the supplied unary function to all query points in this index.

int size () const
 Returns the number of query points in this set.

const QueryPoint & point (int i) const
 Returns a const reference to the query point with the supplied index.

QueryPoint & point (int i)
 Returns the query point with the supplied index.

const QueryPoint & closest (const Geometry::Point &p) const
 Returns the closest query point to the supplied point.

void recolor (const Geometry::Point &a, const Geometry::Point &b, const Geometry::Point &c)
 Recolors all query points in the closure of the triangle with the supplied vertices.

void recolor (const Geometry::Point &a, const Geometry::Point &b, const Geometry::Point &c, const Geometry::Point &d)
 Recolors all query points in the closure of the quadrilateral with the supplied vertices.


Protected Types

typedef CGAL::Kd_tree< SearchTraits > KDTree
 A type of a kd-tree of query points.


Protected Attributes

std::vector< QueryPoint > qpoints
 A vector of the query points.

QueryPointListenerList * listenerLists
 An array of listener lists, one per query point.

Color * color
 An array of colors, one per query point, that indicates their current color.

KDTree * tree
 The KD tree of query points.


Member Typedef Documentation

typedef CGAL::Kd_tree<SearchTraits> Arak::QueryPointIndex::KDTree [protected]
 

A type of a kd-tree of query points.

Definition at line 192 of file query_point.hpp.

Referenced by QueryPointIndex().


Constructor & Destructor Documentation

template<class QueryPointListenerType>
Arak::QueryPointIndex::QueryPointIndex (  const std::vector< Geometry::Point > &  points,
const std::vector< QueryPointListenerType * > &  listeners
)  [inline]
 

Constructor.

This initializes a point index from a vector of Point objects.

Parameters:
points a vector of point objects
listeners a parallel vector of listeners, one per point

Definition at line 309 of file query_point.hpp.

References Arak::QueryPoint::addListener(), Arak::Color, Arak::INVALID_COLOR, KDTree, listenerLists, qpoints, Arak::QueryPointListenerList, and tree.

QueryPointIndex::QueryPointIndex (  const Geometry::Rectangle &  r,
int  rows,
int  cols
) 
 

Constructs a query point index with a grid of query points in the interior of a rectangular window.

Parameters:
r the rectangular window
rows the number of rows in the grid
cols the number of columns in the grid

Definition at line 6 of file query_point.cpp.

References Arak::Color, Arak::INVALID_COLOR, KDTree, listenerLists, Arak::Geometry::Point, qpoints, Arak::QueryPointListenerList, Arak::Geometry::Rectangle, and tree.

QueryPointIndex::QueryPointIndex (  const QueryPointIndex &  q1,
const QueryPointIndex &  q2
) 
 

Constructs a query point containing the query points in both of the supplied indexes.

Parameters:
q1 the first query point index
q2 the second query point index

Definition at line 35 of file query_point.cpp.

References color, Arak::Color, KDTree, listenerLists, point(), qpoints, Arak::QueryPointListenerList, size(), and tree.

QueryPointIndex::~QueryPointIndex (   ) 
 

Destructor.

Definition at line 64 of file query_point.cpp.

References listenerLists, and tree.


Member Function Documentation

void QueryPointIndex::addListeners (  QueryPointListenerFactory &  factory  ) 
 

Adds a query point listener to every query point in this index.

The listeners are generated using the supplied factory.

Parameters:
factory the factory used to generate the listeners

Definition at line 70 of file query_point.cpp.

References Arak::QueryPointListenerFactory::create(), listenerLists, and qpoints.

Referenced by Arak::PointSetColorEstimator::PointSetColorEstimator().

template<class UnaryFunction>
void Arak::QueryPointIndex::apply (  const Geometry::Rectangle &  r,
UnaryFunction &  f
)  const [inline]
 

Searches for all query points in this index that are in the closure of the supplied rectangle.

The supplied unary function is applied to all such points.

Parameters:
r the bounding rectangle
f a unary function that is applied to all points in r

Definition at line 385 of file query_point.hpp.

References output(), and Arak::Geometry::Rectangle.

Referenced by recolor().

template<class UnaryFunction>
void Arak::QueryPointIndex::applyToAll (  UnaryFunction &  f  )  const [inline]
 

Applies the supplied unary function to all query points in this index.

Parameters:
f a unary function that is applied to all points

Definition at line 396 of file query_point.hpp.

References tree.

const QueryPoint & QueryPointIndex::closest (  const Geometry::Point &  p  )  const
 

Returns the closest query point to the supplied point.

Parameters:
p a point
Returns:
the query point closest to the supplied point

Definition at line 75 of file query_point.cpp.

References Arak::Geometry::Point, Arak::QueryPointIndex::SearchTraits::Point_d, and tree.

Referenced by Arak::Coloring::color().

template<class OutputIterator>
void Arak::QueryPointIndex::output (  const Geometry::Rectangle &  r,
OutputIterator  it
)  const [inline]
 

Searches for all query points in this index that are in the closure of the supplied rectangle.

These points are written to the supplied output iterator.

Parameters:
r the bounding rectangle
it an output iterator to which the points are written

Definition at line 369 of file query_point.hpp.

References Arak::Geometry::Rectangle, and tree.

Referenced by apply().

QueryPoint& Arak::QueryPointIndex::point (  int  i  )  [inline]
 

Returns the query point with the supplied index.

Definition at line 413 of file query_point.hpp.

References qpoints.

const QueryPoint& Arak::QueryPointIndex::point (  int  i  )  const [inline]
 

Returns a const reference to the query point with the supplied index.

Definition at line 408 of file query_point.hpp.

References qpoints.

Referenced by Arak::Coloring::addQueryPoints(), Arak::Coloring::getPointWithColor(), Arak::Coloring::initialize(), QueryPointIndex(), Arak::Coloring::read(), Arak::Coloring::readBinary(), Arak::Coloring::test(), and Arak::Coloring::visualize().

void QueryPointIndex::recolor (  const Geometry::Point &  a,
const Geometry::Point &  b,
const Geometry::Point &  c,
const Geometry::Point &  d
) 
 

Recolors all query points in the closure of the quadrilateral with the supplied vertices.

The vertices must be supplied in either clockwise or counter-clockwise order.

Parameters:
a the first vertex of the quadrilateral
b the second vertex of the quadrilateral
c the third vertex of the quadrilateral
d the fourth vertex of the quadrilateral

Definition at line 108 of file query_point.cpp.

References apply(), Arak::Geometry::Point, Arak::Geometry::Rectangle, Arak::Geometry::Segment, and Arak::Geometry::Triangle.

void QueryPointIndex::recolor (  const Geometry::Point &  a,
const Geometry::Point &  b,
const Geometry::Point &  c
) 
 

Recolors all query points in the closure of the triangle with the supplied vertices.

Parameters:
a the first vertex of the triangle
b the second vertex of the triangle
c the third vertex of the triangle

Definition at line 82 of file query_point.cpp.

References apply(), Arak::Geometry::Point, Arak::Geometry::Rectangle, and Arak::Geometry::Triangle.

Referenced by Arak::Coloring::recolored().

int Arak::QueryPointIndex::size (   )  const [inline]
 

Returns the number of query points in this set.

Definition at line 403 of file query_point.hpp.

References qpoints.

Referenced by Arak::Coloring::addQueryPoints(), Arak::Coloring::initialize(), QueryPointIndex(), Arak::Coloring::read(), Arak::Coloring::readBinary(), Arak::Coloring::test(), and Arak::Coloring::visualize().


Member Data Documentation

Color* Arak::QueryPointIndex::color [protected]
 

An array of colors, one per query point, that indicates their current color.

Definition at line 166 of file query_point.hpp.

Referenced by QueryPointIndex().

QueryPointListenerList* Arak::QueryPointIndex::listenerLists [protected]
 

An array of listener lists, one per query point.

Definition at line 160 of file query_point.hpp.

Referenced by addListeners(), QueryPointIndex(), and ~QueryPointIndex().

std::vector<QueryPoint> Arak::QueryPointIndex::qpoints [protected]
 

A vector of the query points.

Definition at line 155 of file query_point.hpp.

Referenced by addListeners(), point(), QueryPointIndex(), and size().

KDTree* Arak::QueryPointIndex::tree [protected]
 

The KD tree of query points.

Definition at line 197 of file query_point.hpp.

Referenced by applyToAll(), closest(), output(), QueryPointIndex(), and ~QueryPointIndex().


The documentation for this class was generated from the following files:
Generated on Wed May 25 14:41:29 2005 for Arak by doxygen 1.3.6