Fermat
Public Types | Public Methods | List of all members
cugar::cuda::Kd_knn< DIM > Struct Template Reference

Detailed description

template<uint32 DIM>
struct cugar::cuda::Kd_knn< DIM >

GPU-based k-Nearest Neighbors lookup context.

This class provides the context to perform 3-dimensional k-nn lookups on the GPU, using a k-d tree.

The following code snippet shows how to use this class:

#include <cugar/kd/cuda/kd_knn.h>
... // code to build the k-d tree and query points here...
// NOTE: even though we're doing 3-dimensional queries,
// we can use Vector4f arrays for better coalescing
cugar::vector<device_tag,cuda::Kd_knn<3>::Result> results( query_points.size() );
knn.run(
query_points.begin(),
query_points.end(),
raw_pointer(kd_nodes),
raw_pointer(kd_ranges),
raw_pointer(kd_leaves),
raw_pointer(kd_points),
raw_pointer(results) );

#include <knn.h>

Public Types

typedef Kd_knn_result Result
 

Public Methods

template<typename QueryIterator , typename PointIterator >
void run (const QueryIterator points_begin, const QueryIterator points_end, const Kd_node *kd_nodes, const uint2 *kd_ranges, const uint2 *kd_leaves, const PointIterator kd_points, Result *results)
 
template<uint32 K, typename QueryIterator , typename PointIterator >
void run (const QueryIterator points_begin, const QueryIterator points_end, const Kd_node *kd_nodes, const uint2 *kd_ranges, const uint2 *kd_leaves, const PointIterator kd_points, Result *results)
 

Member Function Documentation

◆ run() [1/2]

template<uint32 DIM>
template<typename QueryIterator , typename PointIterator >
void cugar::cuda::Kd_knn< DIM >::run ( const QueryIterator  points_begin,
const QueryIterator  points_end,
const Kd_node kd_nodes,
const uint2 *  kd_ranges,
const uint2 *  kd_leaves,
const PointIterator  kd_points,
Result results 
)

perform a k-nn lookup for a set of query points

Parameters
points_beginbeginning of the query point sequence
points_endend of the query point sequence
kd_nodesk-d tree nodes
kd_rangesk-d tree node ranges
kd_leavesk-d tree leaves
kd_pointsk-d tree points
Template Parameters
QueryIteratoran iterator type dereferencing to Vector<float,N>, with N >= 3
PointIteratoran iterator type dereferencing to Vector<float,N>, with N >= 3

◆ run() [2/2]

template<uint32 DIM>
template<uint32 K, typename QueryIterator , typename PointIterator >
void cugar::cuda::Kd_knn< DIM >::run ( const QueryIterator  points_begin,
const QueryIterator  points_end,
const Kd_node kd_nodes,
const uint2 *  kd_ranges,
const uint2 *  kd_leaves,
const PointIterator  kd_points,
Result results 
)

perform a k-nn lookup for a set of query points

Parameters
points_beginbeginning of the query point sequence
points_endend of the query point sequence
kd_nodesk-d tree nodes
kd_rangesk-d tree node ranges
kd_leavesk-d tree leaves
kd_pointsk-d tree points
Template Parameters
Kthe number of requested nearest neighbors K
QueryIteratoran iterator type dereferencing to Vector<float,N>, with N >= 3
PointIteratoran iterator type dereferencing to Vector<float,N>, with N >= 3

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