Commit 943ecc3b authored by Sreekanth Arikatla's avatar Sreekanth Arikatla

BUG: Runtime error for PBD object without geometry map set

Runtime error for PBD object without geometry map set. Check if the map exist before generating constraints
parent b2a10b7a
......@@ -78,12 +78,36 @@ PBDCollisionHandling::generatePBDConstraints()
//std::cout << "EE: " << m_colData->EEColData.size() << "TV: " << m_colData->TVColData.size() << std::endl;
// Generate edge-edge pbd constraints
for (auto& colData : m_colData->EEColData)
{
auto c = std::make_shared<PbdEdgeEdgeConstraint>();
c->initConstraint(dynaModel1, map1->getMapIdx(colData.edgeIdA.first), map1->getMapIdx(colData.edgeIdA.second),
dynaModel2, map2->getMapIdx(colData.edgeIdB.first), map1->getMapIdx(colData.edgeIdB.second));
for (auto& colData : m_colData->EEColData)
{
auto c = std::make_shared<PbdEdgeEdgeConstraint>();
size_t edgeA1, edgeA2;
if (map1)
{
edgeA1 = map1->getMapIdx(colData.edgeIdA.first);
edgeA2 = map1->getMapIdx(colData.edgeIdA.second);
}
else
{
edgeA1 = colData.edgeIdA.first;
edgeA2 = colData.edgeIdA.second;
}
size_t edgeB1, edgeB2;
if (map2)
{
edgeB1 = map2->getMapIdx(colData.edgeIdB.first);
edgeB2 = map2->getMapIdx(colData.edgeIdB.second);
}
else
{
edgeB1 = colData.edgeIdB.first;
edgeB2 = colData.edgeIdB.second;
}
c->initConstraint(dynaModel1, edgeA1, edgeA2,
dynaModel2, edgeB1, edgeB2);
m_PBDConstraints.push_back(c);
}
......@@ -95,12 +119,26 @@ PBDCollisionHandling::generatePBDConstraints()
const auto c = std::make_shared<PbdPointTriangleConstraint>();
size_t v1, v2, v3;
if (map2)
{
v1 = map2->getMapIdx(triVerts[0]);
v2 = map2->getMapIdx(triVerts[1]);
v3 = map2->getMapIdx(triVerts[2]);
}
else
{
v1 = triVerts[0];
v2 = triVerts[1];
v3 = triVerts[2];
}
c->initConstraint(dynaModel1,
colData.vertexIdB,
dynaModel2,
map2->getMapIdx(triVerts[0]),
map2->getMapIdx(triVerts[1]),
map2->getMapIdx(triVerts[2]));
v1,
v2,
v3);
m_PBDConstraints.push_back(c);
}
......
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