nanoflann_mesh_adaptor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020, Sebastian Pütz
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * authors:
34  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
35  *
36  */
37 
38 #ifndef MESH_MAP__NANOFLANN_MESH_ADAPTOR_H
39 #define MESH_MAP__NANOFLANN_MESH_ADAPTOR_H
40 
42 #include "nanoflann.hpp"
43 
44 namespace mesh_map{
46 {
48 
51 
53 
54  inline float kdtree_get_pt(const lvr2::Index idx, const size_t dim) const
55  {
56  const lvr2::VertexHandle vH(idx);
57  if(mesh.containsVertex(vH))
58  {
60  if (dim == 0) return vertex.x;
61  else if (dim == 1) return vertex.y;
62  else return vertex.z;
63  }
64  return std::nanf("");
65  }
66 
67  template <class BBOX>
68  bool kdtree_get_bbox(BBOX& /*bb*/) const { return false; }
69 
70 }; // end of PointCloudAdaptor
71 }
72 
73 #endif /* MESH_MAP__NANOFLANN_MESH_ADAPTOR_H */
lvr2::BaseVector< float >
mesh_map
Definition: abstract_layer.h:47
mesh_map::NanoFlannMeshAdaptor::kdtree_get_bbox
bool kdtree_get_bbox(BBOX &) const
Definition: nanoflann_mesh_adaptor.h:68
lvr2::HalfEdgeMesh::nextVertexIndex
Index nextVertexIndex() const
mesh_map::NanoFlannMeshAdaptor::kdtree_get_pt
float kdtree_get_pt(const lvr2::Index idx, const size_t dim) const
Definition: nanoflann_mesh_adaptor.h:54
lvr2::BaseVector::x
CoordT x
lvr2::HalfEdgeMesh::getVertexPosition
BaseVecT getVertexPosition(VertexHandle handle) const final
mesh_map::NanoFlannMeshAdaptor
Definition: nanoflann_mesh_adaptor.h:45
nanoflann.hpp
lvr2::BaseVector::y
CoordT y
lvr2::VertexHandle
mesh_map::NanoFlannMeshAdaptor::mesh
const lvr2::HalfEdgeMesh< lvr2::BaseVector< float > > & mesh
Definition: nanoflann_mesh_adaptor.h:47
mesh_map::NanoFlannMeshAdaptor::NanoFlannMeshAdaptor
NanoFlannMeshAdaptor(const lvr2::HalfEdgeMesh< lvr2::BaseVector< float >> &mesh)
The constructor that sets the data set source.
Definition: nanoflann_mesh_adaptor.h:50
lvr2::BaseVector::z
CoordT z
lvr2::HalfEdgeMesh::containsVertex
bool containsVertex(VertexHandle vH) const
lvr2::Index
uint32_t Index
mesh_map::NanoFlannMeshAdaptor::kdtree_get_point_count
lvr2::Index kdtree_get_point_count() const
Definition: nanoflann_mesh_adaptor.h:52
HalfEdgeMesh.hpp
lvr2::HalfEdgeMesh


mesh_map
Author(s): Sebastian Pütz
autogenerated on Thu Jan 25 2024 03:42:45