## CGAL::Point_set_2<Gt,Tds>

### Definition

#include <CGAL/Point_set_2.h>

An instance PS of the data type Point_set_2<Gt,Tds> is a Delaunay Triangulation of its vertex set. The class Point_set_2<Gt,Tds> is inherited from the CGAL Delaunay triangulation, and provides additional nearest neighbor query operations and range searching operations.

The Point_set_2<Gt,Tds> class of CGAL depends on template parameters standing for the geometric traits classes used by the point set and by the Delaunay triangulation (Gt) and for the triangulation data structure (Tds).

### Types

typedef Gt::Point_2
| Point; | the point type
typedef Gt::Segment_2
| Segment; | the segment type
typedef Gt::Circle_2
| Circle; | the circle type
typedef Gt::FT | Numb_type; | the representation field number type.

Point_set_2<Gt,Tds>::Triangulation::Vertex
| the vertex type of the underlying triangulation.
Point_set_2<Gt,Tds>::Triangulation::Edge
| the edge type of the underlying triangulation.
Point_set_2<Gt,Tds>::Triangulation::Vertex_handle
| handles to vertices.

### Creation

Point_set_2<Gt,Tds> PS;
| creates an empty Point_set_2<Gt,Tds> .
template<class InputIterator>
Point_set_2<Gt,Tds> PS ( InputIterator first, InputIterator last);
| creates a Point_set_2<Gt,Tds> PS of the points in the range [first,last).

### Operations

Vertex_handle | PS.lookup ( Point p)
|  | if PS contains a Vertex v with |pos(v)| = p the result is a handle to v otherwise the result is NULL.
Vertex_handle | PS.nearest_neighbor ( Point p)
|  | computes a handle to a vertex v of PS that is closest to p. If PS is empty, NULL is returned.
Vertex_handle | PS.nearest_neighbor ( Vertex_handle v)
|  | computes a handle to a vertex w of PS that is closest to v. If v is the only vertex in PS , NULL is returned.
template<class OutputIterator>

OutputIterator

PS.nearest_neighbors ( | Point p, int k, OutputIterator res)

|  | computes the k nearest neighbors of p in PS, and places the handles to the corresponding vertices as a sequence of objects of type Vertex_handle in a container of value type of res which points to the first object in the sequence. The function returns an output iterator pointing to the position beyond the end of the sequence.
template<class OutputIterator>

OutputIterator

PS.nearest_neighbors ( | Vertex_handle v, int k, OutputIterator res)

|  | computes the k nearest neighbors of v, and places them as a sequence of objects of type Vertex_handle in a container of value type of res which points to the first object in the sequence. The function returns an output iterator pointing to the position beyond the end of the sequence.
template<class OutputIterator>
OutputIterator | PS.range_search ( Circle C, OutputIterator res)
|  | computes handles to all vertices contained in the closure of disk C. The computed vertex handles will be placed as a sequence of objects in a container of value type of res which points to the first object in the sequence. The function returns an output iterator pointing to the position beyond the end of the sequence.
template<class OutputIterator>

OutputIterator

PS.range_search ( | Point a, Point b, Point c, OutputIterator res)

|  | computes handles to all vertices contained in the closure of the triangle (a,b,c). Precondition: a, b, and c must not be collinear. The computed vertex handles will be placed as a sequence of objects in a container of value type of res which points to the first object in the sequence. The function returns an output iterator pointing to the position beyond the end of the sequence.
template<class OutputIterator>

OutputIterator

PS.range_search ( | Point a1, Point b1, Point c1, Point d1, OutputIterator res)

computes handles to all vertices contained in the closure of the iso-rectangle (a1,b1,c1,d1).
Precondition: a1 is the upper left point, b1 the lower left, c1 the lower right and d1 the upper right point of the iso rectangle. The computed vertex handles will be placed as a sequence of objects in a container of value type of res which points to the first object in the sequence. The function returns an output iterator pointing to the position beyond the end of the sequence.