Fermat
knn.h
1 /*
2  * Copyright (c) 2010-2018, NVIDIA Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA Corporation nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
32 #pragma once
33 
34 #include <cugar/kd/kd_node.h>
35 #include <cugar/linalg/vector.h>
36 #include <cugar/linalg/bbox.h>
39 #include <thrust/device_vector.h>
40 
41 namespace cugar {
42 namespace cuda {
43 
53 {
54  uint32 index;
55  float dist2;
56 };
57 
58 
95 template <uint32 DIM>
96 struct Kd_knn
97 {
98  typedef Kd_knn_result Result;
99 
111  template <typename QueryIterator, typename PointIterator>
112  void run(
113  const QueryIterator points_begin,
114  const QueryIterator points_end,
115  const Kd_node* kd_nodes,
116  const uint2* kd_ranges,
117  const uint2* kd_leaves,
118  const PointIterator kd_points,
119  Result* results);
120 
133  template <uint32 K, typename QueryIterator, typename PointIterator>
134  void run(
135  const QueryIterator points_begin,
136  const QueryIterator points_end,
137  const Kd_node* kd_nodes,
138  const uint2* kd_ranges,
139  const uint2* kd_leaves,
140  const PointIterator kd_points,
141  Result* results);
142 };
143 
147 } // namespace cuda
148 } // namespace cugar
149 
150 #include <cugar/kd/cuda/knn_inline.h>
Definition: knn.h:52
Definition: kd_node.h:110
Define basic k-d tree node structure.
A CUDA-compatible, fixed-size priority queue.
Definition: knn.h:96
Define CUDA based scan primitives.
Defines an axis-aligned bounding box class.
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38