Commit 669cdb51 authored by Nghia Truong's avatar Nghia Truong
Browse files

BUG: Fix parallel collision detection (bug was due to forgetting to use...

BUG: Fix parallel collision detection (bug was due to forgetting to use separate variables for different threads)
parent 3e9c152d
...@@ -39,8 +39,6 @@ TetraToTetraCD::TetraToTetraCD(std::shared_ptr<TetrahedralMesh> meshA, ...@@ -39,8 +39,6 @@ TetraToTetraCD::TetraToTetraCD(std::shared_ptr<TetrahedralMesh> meshA,
void void
TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<TetrahedralMesh> mesh, size_t idOffset) TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<TetrahedralMesh> mesh, size_t idOffset)
{ {
Vec3d min, max; //bounding box of a tetrahedron
Vec3d vPos;
const auto eps = MACHINE_PRECISION; const auto eps = MACHINE_PRECISION;
const double eps2 = 1e-10; const double eps2 = 1e-10;
...@@ -59,9 +57,12 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra ...@@ -59,9 +57,12 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra
{ {
vInd[i] += idOffset; vInd[i] += idOffset;
} }
Vec3d min, max; //bounding box of a tetrahedron
mesh->computeTetrahedronBoundingBox(tId, min, max); mesh->computeTetrahedronBoundingBox(tId, min, max);
std::vector<size_t> collP = m_hashTable.getPointsInAABB(min, max); std::vector<size_t> collP = m_hashTable.getPointsInAABB(min, max);
assert(collP.size() >= 4); assert(collP.size() >= 4);
if (collP.size() > 4) if (collP.size() > 4)
{ {
for (size_t vId : collP) for (size_t vId : collP)
...@@ -72,8 +73,8 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra ...@@ -72,8 +73,8 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra
vId != vInd[2] && vId != vInd[2] &&
vId != vInd[3]) vId != vInd[3])
{ {
//this determines vertex belonging part of the penetration type //this determines vertex belonging part of the penetration type and gets vertex position
//and gets vertex position Vec3d vPos;
if (vId < m_meshA->getNumVertices()) if (vId < m_meshA->getNumVertices())
{ {
vPos = nodesMeshA[vId]; vPos = nodesMeshA[vId];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment