RINGMesh  Version 5.0.0
A programming library for geological model meshes
RINGMesh::NNSearch< DIMENSION > Class Template Reference

#include <nn_search.h>

Classes

class  Impl
 

Public Member Functions

 NNSearch (const std::vector< vecn< DIMENSION > > &vertices, bool copy=true)
 
 ~NNSearch ()=default
 
std::tuple< index_t, std::vector< index_t > > get_colocated_index_mapping (double epsilon) const
 Gets the index_map that link all the duplicated points to their first occurancy. More...
 
std::tuple< index_t, std::vector< index_t >, std::vector< vecn< DIMENSION > > > get_colocated_index_mapping_and_unique_points (double epsilon) const
 Gets the index_map that link all the points to a no duplicated list of index in the list of unique_points. More...
 
index_t get_closest_neighbor (const vecn< DIMENSION > &v) const
 
std::vector< index_t > get_neighbors (const vecn< DIMENSION > &v, double threshold_distance) const
 
template<typename TEST >
std::vector< index_t > get_neighbors (const vecn< DIMENSION > &v, const TEST &test) const
 
std::vector< index_t > get_neighbors (const vecn< DIMENSION > &v, index_t nb_neighbors) const
 
vecn< DIMENSION > point (index_t v) const
 
index_t nb_points () const
 

Private Member Functions

 ringmesh_disable_copy_and_move (NNSearch)
 
 ringmesh_template_assert_2d_or_3d (DIMENSION)
 
 IMPLEMENTATION_MEMBER (impl_)
 

Detailed Description

template<index_t DIMENSION>
class RINGMesh::NNSearch< DIMENSION >

Definition at line 50 of file nn_search.h.

Constructor & Destructor Documentation

◆ NNSearch()

template<index_t DIMENSION>
RINGMesh::NNSearch< DIMENSION >::NNSearch ( const std::vector< vecn< DIMENSION > > &  vertices,
bool  copy = true 
)
explicit

Definition at line 135 of file nn_search.cpp.

◆ ~NNSearch()

template<index_t DIMENSION>
RINGMesh::NNSearch< DIMENSION >::~NNSearch ( )
default

Member Function Documentation

◆ get_closest_neighbor()

template<index_t DIMENSION>
index_t RINGMesh::NNSearch< DIMENSION >::get_closest_neighbor ( const vecn< DIMENSION > &  v) const
inline

Gets the closest neighbor point

Parameters
[in]vthe point to test return returns the index of the closest point

Definition at line 92 of file nn_search.h.

◆ get_colocated_index_mapping()

template<index_t DIMENSION>
std::tuple< index_t, std::vector< index_t > > RINGMesh::NNSearch< DIMENSION >::get_colocated_index_mapping ( double  epsilon) const

Gets the index_map that link all the duplicated points to their first occurancy.

Returns
the number of colocated vertices Example: vertices = [P1, P2, P1, P3, P2, P4] index_map = [0, 1, 0, 3, 1, 5] return 2

Definition at line 155 of file nn_search.cpp.

◆ get_colocated_index_mapping_and_unique_points()

template<index_t DIMENSION>
std::tuple< index_t, std::vector< index_t >, std::vector< vecn< DIMENSION > > > RINGMesh::NNSearch< DIMENSION >::get_colocated_index_mapping_and_unique_points ( double  epsilon) const

Gets the index_map that link all the points to a no duplicated list of index in the list of unique_points.

Returns
the number of colocated vertices Example: vertices = [P1, P2, P1, P3, P2, P4] unique_points = [P1, P2, P3, P4] index_map = [0, 1, 0, 2, 1, 3] return 2

Definition at line 177 of file nn_search.cpp.

◆ get_neighbors() [1/3]

template<index_t DIMENSION>
std::vector< index_t > RINGMesh::NNSearch< DIMENSION >::get_neighbors ( const vecn< DIMENSION > &  v,
double  threshold_distance 
) const

Compute the neighbors of a given point, point closer than

Parameters
threshold_distance
[in]vthe point to test
[in]threshold_distancedistance defining the neighborhood
Returns
the point indices

Definition at line 205 of file nn_search.cpp.

◆ get_neighbors() [2/3]

template<index_t DIMENSION>
template<typename TEST >
std::vector< index_t > RINGMesh::NNSearch< DIMENSION >::get_neighbors ( const vecn< DIMENSION > &  v,
const TEST &  test 
) const
inline

Compute the neighbors of a given point according the

Parameters
test
[in]vthe point to test
Template Parameters

Definition at line 117 of file nn_search.h.

◆ get_neighbors() [3/3]

template<index_t DIMENSION>
std::vector< index_t > RINGMesh::NNSearch< DIMENSION >::get_neighbors ( const vecn< DIMENSION > &  v,
index_t  nb_neighbors 
) const

Gets the neighboring points of a given one sorted by increasing distance

Parameters
[in]vthe point to test
[in]nb_neighborsthe number of neighbors to return
Returns
the point indices (can be less than nb_neighbors if there is not enough points)

Definition at line 216 of file nn_search.cpp.

◆ IMPLEMENTATION_MEMBER()

template<index_t DIMENSION>
RINGMesh::NNSearch< DIMENSION >::IMPLEMENTATION_MEMBER ( impl_  )
private

◆ nb_points()

template<index_t DIMENSION>
index_t RINGMesh::NNSearch< DIMENSION >::nb_points ( ) const

Definition at line 148 of file nn_search.cpp.

◆ point()

template<index_t DIMENSION>
vecn< DIMENSION > RINGMesh::NNSearch< DIMENSION >::point ( index_t  v) const

Definition at line 142 of file nn_search.cpp.

◆ ringmesh_disable_copy_and_move()

template<index_t DIMENSION>
RINGMesh::NNSearch< DIMENSION >::ringmesh_disable_copy_and_move ( NNSearch< DIMENSION >  )
private

◆ ringmesh_template_assert_2d_or_3d()

template<index_t DIMENSION>
RINGMesh::NNSearch< DIMENSION >::ringmesh_template_assert_2d_or_3d ( DIMENSION  )
private

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