29 #ifndef NVBLASTGEOMETRY_H 30 #define NVBLASTGEOMETRY_H 63 const uint32_t firstGraphNodeIndex,
const uint32_t* familyGraphNodeIndexLinks,
64 const uint32_t* adjacencyPartition,
const uint32_t* adjacentNodeIndices,
const uint32_t* adjacentBondIndices,
65 const NvBlastBond* assetBonds,
const float* bondHealths,
66 const NvBlastChunk* assetChunks,
const float* supportChunkHealths,
const uint32_t* chunkIndices)
70 uint32_t nodeIndex = firstGraphNodeIndex;
73 uint32_t closestNode = nodeIndex;
74 float minDist = std::numeric_limits<float>().max();
79 if (supportChunkHealths[nodeIndex] > 0.0f)
81 uint32_t chunkIndex = chunkIndices[nodeIndex];
85 const float* centroid = chunk.
centroid;
93 closestNode = nodeIndex;
97 nodeIndex = familyGraphNodeIndexLinks[nodeIndex];
103 bool iterateOnBonds =
true;
109 nodeIndex = closestNode;
110 minDist = std::numeric_limits<float>().max();
112 const uint32_t startIndex = adjacencyPartition[nodeIndex];
113 const uint32_t stopIndex = adjacencyPartition[nodeIndex + 1];
115 for (uint32_t adjacentIndex = startIndex; adjacentIndex < stopIndex; adjacentIndex++)
117 const uint32_t neighbourIndex = adjacentNodeIndices[adjacentIndex];
118 const uint32_t neighbourChunk = chunkIndices[neighbourIndex];
121 const uint32_t bondIndex = adjacentBondIndices[adjacentIndex];
123 if (bondHealths[bondIndex] > 0.0f && supportChunkHealths[neighbourIndex] > 0.0f)
127 const float* centroid = bond.
centroid;
135 if (nodeIndex < neighbourIndex)
137 closestNode = s < 0.0f ? nodeIndex : neighbourIndex;
141 closestNode = s < 0.0f ? neighbourIndex : nodeIndex;
172 const uint32_t firstGraphNodeIndex,
const uint32_t* familyGraphNodeIndexLinks,
173 const uint32_t* adjacencyPartition,
const uint32_t* adjacentNodeIndices,
const uint32_t* adjacentBondIndices,
174 const NvBlastBond* bonds,
const float* bondHealths,
const uint32_t* chunkIndices)
178 uint32_t nodeIndex = firstGraphNodeIndex;
181 uint32_t closestNode = nodeIndex;
182 float minDist = std::numeric_limits<float>().max();
186 const uint32_t startIndex = adjacencyPartition[nodeIndex];
187 const uint32_t stopIndex = adjacencyPartition[nodeIndex + 1];
189 for (uint32_t adjacentIndex = startIndex; adjacentIndex < stopIndex; adjacentIndex++)
191 const uint32_t neighbourIndex = adjacentNodeIndices[adjacentIndex];
192 if (nodeIndex < neighbourIndex)
194 const uint32_t bondIndex = adjacentBondIndices[adjacentIndex];
195 if (bondHealths[bondIndex] > 0.0f)
199 const float* centroid = bond.
centroid;
209 closestNode = nodeIndex;
213 closestNode = neighbourIndex;
218 closestNode = s < 0 ? nodeIndex : neighbourIndex;
224 nodeIndex = familyGraphNodeIndexLinks[nodeIndex];
237 #endif // NVBLASTGEOMETRY_H Definition: NvBlastTypes.h:189
NV_INLINE float dist(const float a[3], const float b[3])
Definition: NvBlastMath.h:86
float normal[3]
Definition: NvBlastTypes.h:194
float centroid[3]
Definition: NvBlastTypes.h:157
NV_INLINE bool isInvalidIndex(T index)
Definition: NvBlastIndexFns.h:57
NV_INLINE void sub(const float a[3], const float b[3], float r[3])
Definition: NvBlastMath.h:67
#define NVBLAST_ASSERT(exp)
Definition: NvBlastAssert.h:37
float centroid[3]
Definition: NvBlastTypes.h:204
NV_FORCE_INLINE uint32_t findClosestNode(const float point[4], const uint32_t firstGraphNodeIndex, const uint32_t *familyGraphNodeIndexLinks, const uint32_t *adjacencyPartition, const uint32_t *adjacentNodeIndices, const uint32_t *adjacentBondIndices, const NvBlastBond *assetBonds, const float *bondHealths, const NvBlastChunk *assetChunks, const float *supportChunkHealths, const uint32_t *chunkIndices)
Definition: NvBlastGeometry.h:62
Definition: NvBlastTypes.h:152
NV_INLINE float dot(const float a[3], const float b[3])
Definition: NvBlastMath.h:73
Definition: NvBlastArray.h:37
#define NV_FORCE_INLINE
Definition: NvPreprocessor.h:365