1#ifndef PBAT_GPU_IMPL_CONTACT_VERTEXTRIANGLEMIXEDCCDDCD_H
2#define PBAT_GPU_IMPL_CONTACT_VERTEXTRIANGLEMIXEDCCDDCD_H
6#include "pbat/gpu/impl/common/Buffer.cuh"
7#include "pbat/gpu/impl/geometry/Aabb.cuh"
8#include "pbat/gpu/impl/geometry/Bvh.cuh"
9#include "pbat/gpu/impl/geometry/Morton.cuh"
12namespace pbat::gpu::impl::contact {
20 static auto constexpr kDims = 3;
32 Eigen::Ref<GpuIndexVectorX const>
const&
B,
33 Eigen::Ref<GpuIndexVectorX const>
const&
V,
34 Eigen::Ref<GpuIndexMatrixX const>
const&
F);
52 geometry::Morton::Bound
const& wmin,
53 geometry::Morton::Bound
const& wmax);
76 template <
class FOnNearestNeighbourFound>
79 FOnNearestNeighbourFound fOnNearestNeighbourFound);
108template <
class FOnNearestNeighbourFound>
111 FOnNearestNeighbourFound fOnNearestNeighbourFound)
114 auto fGetQueryObject = [x = x.Raw(),
V =
V.Raw(),
av =
av.Raw()] PBAT_DEVICE(
GpuIndex q) {
116 return FromBuffers<3, 1>(x,
V[v]);
118 auto fMinDistanceToBox = [] PBAT_DEVICE(
119 SVector<GpuScalar, 3>
const& xi,
120 SVector<GpuScalar, 3>
const& L,
121 SVector<GpuScalar, 3>
const& U) {
124 auto fDistanceToLeaf =
125 [x = x.Raw(),
V =
V.Raw(),
F =
F.Raw(),
B =
B.Raw(),
av =
av.Raw()] PBAT_DEVICE(
127 SVector<GpuScalar, 3>
const& xi,
131 auto fv = FromBuffers<3, 1>(
F, f);
132 bool const bFromSameBody =
B[i] ==
B[fv[0]];
134 return std::numeric_limits<GpuScalar>::max();
147 Fbvh.NearestNeighbours<
148 decltype(fGetQueryObject),
149 decltype(fMinDistanceToBox),
150 decltype(fDistanceToLeaf),
151 decltype(fDistanceUpperBound),
152 decltype(fOnNearestNeighbourFound),
160 fOnNearestNeighbourFound,
This file contains functions to answer distance queries.
This file includes all the mini linear algebra headers.
Radix-tree linear BVH.
Definition Bvh.cuh:34
Type aliases for GPU code.
PBAT_HOST_DEVICE auto PointTriangle(TMatrixP const &P, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C) -> typename TMatrixP::ScalarType
Obtain squared distance between point P and triangle ABC.
Definition DistanceQueries.h:217
PBAT_HOST_DEVICE auto PointAxisAlignedBoundingBox(TMatrixP const &P, TMatrixL const &L, TMatrixU const &U) -> typename TMatrixP::ScalarType
Obtain squared distance between point P and axis-aligned box (L,U)
Definition DistanceQueries.h:199
Mini linear algebra related functionality.
Definition Assign.h:12
float GpuScalar
Scalar type for GPU code.
Definition Aliases.h:19
std::int32_t GpuIndex
Index type for GPU code.
Definition Aliases.h:20