CGAL 6.1.2 - 2D Range and Neighbor Search: Nearest Neighbor Search

CGAL 6.1.2 - 2D Range and Neighbor Search

Loading...
Searching...
No Matches
Functions
Nearest Neighbor Search
Reference Manual

##

## Functions
template<class Dt >
Dt::Vertex_handle | CGAL::nearest_neighbor (const Dt &delau, Dt::Vertex_handle v)
| computes a handle to a vertex `w` of `delau` that is closest to `v`.
template<class Dt , class OutputIterator >
OutputIterator | CGAL::nearest_neighbors (Dt &delau, const Dt::Point &p, Dt::size_type k, OutputIterator res)
| computes the `k` nearest neighbors of `p` in `delau`, 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.
template<class Dt , class OutputIterator >
OutputIterator | CGAL::nearest_neighbors (Dt &delau, Dt::Vertex_handle v, Dt::size_type k, OutputIterator res)
| computes the `k` nearest neighbors of `v` (including `v`) in `delau`, 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.

## Function Documentation

## ◆ nearest_neighbor()

template<class Dt >

Dt::Vertex_handle CGAL::nearest_neighbor | ( | const Dt & | delau,
|  | Dt::Vertex_handle | v
| ) |  |

`#include <CGAL/nearest_neighbor_delaunay_2.h>`

computes a handle to a vertex `w` of `delau` that is closest to `v`.

If `v` is the only vertex in `delau`, `NULL` is returned.

Requirements

`Dt` is a CGAL Delaunay triangulation and contains the following subset of types from the concept `PointSetTraits` and from the Delaunay triangulation data type:

- `Dt::Geom_traits`
- `Dt::Point`
- `Dt::Vertex_circulator`
- `Dt::Vertex_handle`
- `Dt::Geom_traits::Compare_distance_2`

## ◆ nearest_neighbors() [1/2]

template<class Dt , class OutputIterator >

OutputIterator CGAL::nearest_neighbors | ( | Dt & | delau,
|  | const Dt::Point & | p,
|  | Dt::size_type | k,
|  | OutputIterator | res
| ) |  |

`#include <CGAL/nearest_neighbor_delaunay_2.h>`

computes the `k` nearest neighbors of `p` in `delau`, 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.

The function `nearest_neighbors()` is the function template version of the k nearest neighbors search on Delaunay triangulations. There are two versions of this function, one taking a point of the Delaunay triangulation and the other taking a vertex handle.

Requirements

`Dt` is a CGAL Delaunay triangulation and contains the following subset of types from the concept `PointSetTraits` and from the Delaunay triangulation data type:

- `Dt::Geom_traits`
- `Dt::Vertex_handle`
- `Dt::Vertex_iterator`
- `Dt::Vertex_circulator`
- `Dt::Vertex`
- `Dt::Face`
- `Dt::Face_handle`
- `Dt::Locate_type`
- `Dt::Point`
- `Dt::Geom_traits::FT`
- `Dt::Geom_traits::Compute_squared_distance_2`

## ◆ nearest_neighbors() [2/2]

template<class Dt , class OutputIterator >

OutputIterator CGAL::nearest_neighbors | ( | Dt & | delau,
|  | Dt::Vertex_handle | v,
|  | Dt::size_type | k,
|  | OutputIterator | res
| ) |  |

`#include <CGAL/nearest_neighbor_delaunay_2.h>`

computes the `k` nearest neighbors of `v` (including `v`) in `delau`, 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.

The function `nearest_neighbors()` is the function template version of the k nearest neighbors search on Delaunay triangulations. There are two versions of this function, one taking a point of the Delaunay triangulation and the other taking a vertex handle.

Requirements

`Dt` is a CGAL Delaunay triangulation and contains the following subset of types from the concept `PointSetTraits` and from the Delaunay triangulation data type:

- `Dt::Geom_traits`
- `Dt::Vertex_handle`
- `Dt::Vertex_iterator`
- `Dt::Vertex_circulator`
- `Dt::Vertex`
- `Dt::Point`
- `Dt::Geom_traits::FT`
- `Dt::Geom_traits::Compute_squared_distance_2`