mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-13 21:30:09 +00:00
add guard agaist non-manifold geometry in vtk files
This commit is contained in:
parent
196d0645b1
commit
5498c575c8
@ -8281,6 +8281,11 @@ bool PhysicsServerCommandProcessor::processDeformable(const UrdfDeformable& defo
|
|||||||
if (softWorld)
|
if (softWorld)
|
||||||
{
|
{
|
||||||
psb = btSoftBodyHelpers::CreateFromTriMesh(softWorld->getWorldInfo(), &vertices[0], &indices[0], numTris);
|
psb = btSoftBodyHelpers::CreateFromTriMesh(softWorld->getWorldInfo(), &vertices[0], &indices[0], numTris);
|
||||||
|
if (!psb)
|
||||||
|
{
|
||||||
|
printf("Load deformable failed\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -8288,6 +8293,11 @@ bool PhysicsServerCommandProcessor::processDeformable(const UrdfDeformable& defo
|
|||||||
if (deformWorld)
|
if (deformWorld)
|
||||||
{
|
{
|
||||||
psb = btSoftBodyHelpers::CreateFromTriMesh(deformWorld->getWorldInfo(), &vertices[0], &indices[0], numTris);
|
psb = btSoftBodyHelpers::CreateFromTriMesh(deformWorld->getWorldInfo(), &vertices[0], &indices[0], numTris);
|
||||||
|
if (!psb)
|
||||||
|
{
|
||||||
|
printf("Load deformable failed\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8312,6 +8322,11 @@ bool PhysicsServerCommandProcessor::processDeformable(const UrdfDeformable& defo
|
|||||||
if (deformWorld)
|
if (deformWorld)
|
||||||
{
|
{
|
||||||
psb = btSoftBodyHelpers::CreateFromVtkFile(deformWorld->getWorldInfo(), out_found_sim_filename.c_str());
|
psb = btSoftBodyHelpers::CreateFromVtkFile(deformWorld->getWorldInfo(), out_found_sim_filename.c_str());
|
||||||
|
if (!psb)
|
||||||
|
{
|
||||||
|
printf("Load deformable failed\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
btScalar corotated_mu(0.), corotated_lambda(0.);
|
btScalar corotated_mu(0.), corotated_lambda(0.);
|
||||||
corotated_mu = deformable.m_corotatedCoefficients.mu;
|
corotated_mu = deformable.m_corotatedCoefficients.mu;
|
||||||
corotated_lambda = deformable.m_corotatedCoefficients.lambda;
|
corotated_lambda = deformable.m_corotatedCoefficients.lambda;
|
||||||
|
@ -1300,6 +1300,14 @@ btSoftBody* btSoftBodyHelpers::CreateFromVtkFile(btSoftBodyWorldInfo& worldInfo,
|
|||||||
}
|
}
|
||||||
else if (reading_tets)
|
else if (reading_tets)
|
||||||
{
|
{
|
||||||
|
int d;
|
||||||
|
ss >> d;
|
||||||
|
if (d != 4)
|
||||||
|
{
|
||||||
|
printf("Load deformable failed: Only Tetrahedra are supported in VTK file.\n");
|
||||||
|
fs.close();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
ss.ignore(128, ' '); // ignore "4"
|
ss.ignore(128, ' '); // ignore "4"
|
||||||
Index tet;
|
Index tet;
|
||||||
tet.resize(4);
|
tet.resize(4);
|
||||||
|
Loading…
Reference in New Issue
Block a user