|
| SparseSpatialHash (muda::Stream &stream=muda::Stream::Default()) |
|
template<typename Pred = DefaultPredication> |
void | detect (CBufferView< BoundingSphere > spheres, DeviceBuffer< CollisionPair > &collisionPairs, Pred &&pred={}) |
| Detect collision pairs from bounding spheres. Note that:
|
|
template<typename Pred = DefaultPredication> |
void | detect (int level, CBufferView< BoundingSphere > spheres, DeviceBuffer< CollisionPair > &collisionPairs, Pred &&pred={}) |
| Detect collision pairs from bounding spheres at a specific level (level >= 0). This is used for hierarchical spatial hashing collision detection. Its user's responsibility to set level value to a bounding sphere. Normally, higher level means larger bounding sphere. Users should decide a proper range of radius for each level, like:
|
|
◆ detect() [1/2]
template<typename Hash = Morton<uint32_t>>
template<typename Pred = DefaultPredication>
Detect collision pairs from bounding spheres. Note that:
- The collision pairs are unique but not sorted.
- All
(i,j)
pairs in collisionPairs satisfy i < j
.
- Parameters
-
[in] | spheres | bounding spheres |
[out] | collisionPairs | output collision pairs |
[in] | pred | predication function. f: __device__ (int i, int j) -> bool . If pred(i,j) is true, then the collision pair (i,j) is recorded, else the collision pair is discarded. |
- See also
- DefaultPredication
◆ detect() [2/2]
template<typename Hash = Morton<uint32_t>>
template<typename Pred = DefaultPredication>
Detect collision pairs from bounding spheres at a specific level (level >= 0). This is used for hierarchical spatial hashing collision detection. Its user's responsibility to set level
value to a bounding sphere. Normally, higher level means larger bounding sphere. Users should decide a proper range of radius for each level, like:
if (r < r0) s.level = 0;
else if (r < r1) s.level = 1;
else s.level = 2;
...
Definition bounding_volume.h:9
Note that:
- For a level
L
, any bounding spheres has a level <= L
will be taken into account.
- The collision pairs are unique but not sorted.
- All
(i,j)
pairs in collisionPairs satisfy i < j
.
- The
collisionPairs
will be appended with new collision pairs (not cleared).
Typical usage:
for (int level = 0; level < level_count; ++level)
{
detect(level, spheres, collisionPairs);
}
A std::vector like wrapper of cuda device memory, allows user to:
Definition device_buffer.h:46
void detect(CBufferView< BoundingSphere > spheres, DeviceBuffer< CollisionPair > &collisionPairs, Pred &&pred={})
Detect collision pairs from bounding spheres. Note that:
Definition sparse_spatial_hash.h:41
- Parameters
-
[in] | level | the hierarchy level we want to detect |
[in] | spheres | bounding spheres |
[out] | collisionPairs | appended output collision pairs |
[in] | pred | predication function. f: __device__ (int i, int j) -> bool . If pred(i,j) is true, then the collision pair (i,j) is recorded, else the collision pair is discarded. |
- See also
- DefaultPredication
The documentation for this class was generated from the following file: