Skip to content

Commit af83e2f

Browse files
authored
Merge pull request #1 from InteractiveComputerGraphics/neighbor_list
new method PointSet::neighbor_list
2 parents d4c4eb6 + 7081046 commit af83e2f

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

LICENSE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2019 Interactive Computer Graphics
3+
Copyright (c) 2019-present, cuNSearch contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cuNSearch
22
A C++/CUDA library to efficiently compute neighborhood information on the GPU for 3D point clouds within a fixed radius. Suitable for many applications, e.g. neighborhood search for SPH fluid simulations.
33

4-
The library interface is similar to CompactNSearch (https://github.com/InteractiveComputerGraphics/CompactNSearch)
4+
The library interface is similar to the CPU neighborhood search [CompactNSearch](https://github.com/InteractiveComputerGraphics/CompactNSearch).
55
## Libraries using cuNSearch
66

77
* [SPlisHSPlasH](https://github.com/InteractiveComputerGraphics/SPlisHSPlasH) - A C++ library for the physically-based simulation of fluids using Smoothed Particle Hydrodynamics (see screenshot)

include/PointSet.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ class PointSet
7979
const auto &neighborSet = neighbors[point_set];
8080
return neighborSet.Neighbors[neighborSet.Offsets[i] + k];
8181
}
82+
83+
/**
84+
* Fetches pointer to neighbors of point i in the given point set.
85+
* @param point_set Point set index of other point set where neighbors have been searched.
86+
* @param i Point index for which the neighbor id should be returned.
87+
* @returns Pointer to ids of neighboring points of i in point set point_set.
88+
*/
89+
inline unsigned int * neighbor_list(unsigned int point_set, unsigned int i) const
90+
{
91+
//Return index of the k-th neighbor to point i (of the given point set)
92+
const auto &neighborSet = neighbors[point_set];
93+
return &neighborSet.Neighbors[neighborSet.Offsets[i]];
94+
}
8295

8396
/**
8497
* @returns the number of points contained in the point set.

0 commit comments

Comments
 (0)