Commit 7af41719 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

STYKE: Correct style

parent 1233c057
......@@ -330,16 +330,16 @@ int main()
scene->addSceneObject(floor);
auto colData = std::make_shared<CollisionData>();
auto CD = std::make_shared<MeshToMeshBruteForceCD>(floor->getCollidingGeometry(),
auto CD = std::make_shared<MeshToMeshBruteForceCD>(floor->getCollidingGeometry(),
surfMesh,
*colData.get());
auto CH = std::make_shared<PBDCollisionHandling>(CollisionHandling::Side::B,
auto CH = std::make_shared<PBDCollisionHandling>(CollisionHandling::Side::A,
CD->getCollisionData(),
floor,
deformableObj);
//scene->getCollisionGraph()->addInteractionPair(floor, deformableObj, CD, CH, nullptr);
scene->getCollisionGraph()->addInteractionPair(floor, deformableObj, CD, CH, nullptr);
}
>>>>>>> WIP: Change SceneManager to straighten PBD pipeline
......@@ -350,7 +350,7 @@ int main()
scene->addLight(light);
sdk->setActiveScene(scene);
sdk->startSimulation(SimulationStatus::RUNNING);
sdk->startSimulation(SimulationStatus::PAUSED);
return 0;
}
......@@ -177,7 +177,7 @@ CollisionDetection::makeCollisionDetectionObject(const Type& type,
if (geometry1 == nullptr || surfaceGeo == nullptr)
{
LOG(WARNING) << "CollisionDetection::make_collision_detection error: "
<< "invalid object geometries for MeshToMeshBruteForce collision detection.";
<< "invalid object geometries for MeshToMeshBruteForce collision detection.";
return nullptr;
}
return std::make_shared<MeshToMeshBruteForceCD>(geometry1, surfaceGeo, colData);
......
......@@ -38,7 +38,7 @@ MeshToMeshBruteForceCD::computeCollisionData()
{
// Clear collisionData
m_colData.clearAll();
// Broad phase collision
doBroadPhaseCollisionCheck();
......@@ -50,7 +50,7 @@ MeshToMeshBruteForceCD::computeCollisionData()
auto mesh1 = std::static_pointer_cast<LineMesh>(m_object1);
// brute force, use BVH or spatial grid would be much better
// point
for (size_t i = 0; i < mesh1->getNumVertices(); ++i)
{
......@@ -67,8 +67,8 @@ MeshToMeshBruteForceCD::computeCollisionData()
if (testPointToTriAABB(p[0], p[1], p[2],
p0[0], p0[1], p0[2],
p1[0], p1[1], p1[2],
p2[0], p2[1], p2[2],
m_proximityTolerance,
p2[0], p2[1], p2[2],
m_proximityTolerance,
m_proximityTolerance))
{
TriangleVertexCollisionData d(j, i);
......@@ -223,7 +223,7 @@ MeshToMeshBruteForceCD::computeCollisionData()
const Vec3d p0 = mesh2->getVertexPosition(e[0]);
const Vec3d p1 = mesh2->getVertexPosition(e[1]);
const Vec3d p2 = mesh2->getVertexPosition(e[2]);
if (E2[e[0]][e[1]] && E2[e[1]][e[0]])
{
if (testLineToLineAABB(P[0], P[1], P[2],
......@@ -237,7 +237,7 @@ MeshToMeshBruteForceCD::computeCollisionData()
E2[e[0]][e[1]] = 0;
}
}
if (E2[e[1]][e[2]] && E2[e[2]][e[1]])
{
if (testLineToLineAABB(P[0], P[1], P[2],
......@@ -356,7 +356,7 @@ MeshToMeshBruteForceCD::computeCollisionData()
E2[e[0]][e[1]] = 0;
}
}
if (E2[e[1]][e[2]] && E2[e[2]][e[1]])
{
if (testLineToLineAABB(P[0], P[1], P[2],
......@@ -370,7 +370,7 @@ MeshToMeshBruteForceCD::computeCollisionData()
E2[e[1]][e[2]] = 0;
}
}
if (E2[e[2]][e[0]] && E2[e[0]][e[2]])
{
if (testLineToLineAABB(P[0], P[1], P[2],
......@@ -416,5 +416,4 @@ MeshToMeshBruteForceCD::doBroadPhaseCollisionCheck() const
min2[2] - m_proximityTolerance,
max2[2] + m_proximityTolerance);
}
} // imstk
......@@ -31,14 +31,13 @@
namespace imstk
{
void
PBDCollisionHandling::processCollisionData()
{
/*if (auto deformableObj = std::dynamic_pointer_cast<DeformableObject>(m_object))
{
this->computeContactForcesDiscreteDeformable(deformableObj);
}
}
else if (auto analyticObj = std::dynamic_pointer_cast<CollidingObject>(m_object))
{
this->computeContactForcesAnalyticRigid(analyticObj);
......@@ -52,7 +51,7 @@ PBDCollisionHandling::processCollisionData()
this->generatePBDConstraints();
}
void
void
PBDCollisionHandling::generatePBDConstraints()
{
// clear the constraints before populating wit new ones
......@@ -75,7 +74,7 @@ PBDCollisionHandling::generatePBDConstraints()
c->initConstraint(dynaModel1, map1->getMapIdx(colData.edgeIdA.first), map1->getMapIdx(colData.edgeIdA.second),
dynaModel2, map2->getMapIdx(colData.edgeIdB.first), map1->getMapIdx(colData.edgeIdB.second));
m_PBDConstraints.push_back(c);
}
......@@ -85,10 +84,10 @@ PBDCollisionHandling::generatePBDConstraints()
const auto triVerts = colGeo2->getTrianglesVertices()[colData.triIdA];
const auto c = std::make_shared<PbdPointTriangleConstraint>();
c->initConstraint(dynaModel1,
c->initConstraint(dynaModel1,
colData.vertexIdB,
dynaModel2,
dynaModel2,
map2->getMapIdx(triVerts[0]),
map2->getMapIdx(triVerts[1]),
map2->getMapIdx(triVerts[2]));
......@@ -96,5 +95,4 @@ PBDCollisionHandling::generatePBDConstraints()
m_PBDConstraints.push_back(c);
}
}
}
\ No newline at end of file
......@@ -42,16 +42,16 @@ class PbdCollisionConstraint;
///
class PBDCollisionHandling : public CollisionHandling
{
typedef std::vector<std::shared_ptr<PbdCollisionConstraint>> PBDConstraintVector;
typedef std::vector<std::shared_ptr<PbdCollisionConstraint>> PBDConstraintVector;
public:
///
/// \brief Constructor
///
PBDCollisionHandling(const Side& side,
const CollisionData& colData,
std::shared_ptr<PbdObject> obj1,
std::shared_ptr<PbdObject> obj2) :
const CollisionData& colData,
std::shared_ptr<PbdObject> obj1,
std::shared_ptr<PbdObject> obj2) :
CollisionHandling(Type::Penalty, side, colData),
m_pbdObject1(obj1),
m_pbdObject2(obj2){}
......@@ -67,7 +67,7 @@ public:
/// \brief Compute forces based on collision data
///
void processCollisionData() override;
///
/// \brief Generate appropriate PBD constraints based on the collision data
///
......
......@@ -66,7 +66,7 @@ SceneManager::runModule()
else if (auto collidingObj = std::dynamic_pointer_cast<CollidingObject>(obj))
{
collidingObj->resetForce();
}
}
}
// Update objects controlled by the device controllers
......@@ -78,12 +78,12 @@ SceneManager::runModule()
// Compute collision data per interaction pair
for (auto intPair : m_scene->getCollisionGraph()->getInteractionPairList())
{
intPair->computeCollisionData();
intPair->computeCollisionData();
}
// Process collision data per interaction pair
for (auto intPair : m_scene->getCollisionGraph()->getInteractionPairList())
{
{
intPair->processCollisionData();
}
......@@ -113,7 +113,7 @@ SceneManager::runModule()
auto timeElapsed = wwt.getTimeElapsed(StopWatch::TimeUnitType::seconds);
// Update time step size of the dynamic objects
// Update time step size of the dynamic objects
for (auto obj : m_scene->getSceneObjects())
{
if (obj->getType() == SceneObject::Type::Pbd)
......
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