Commit 7cf4b857 authored by Nghia Truong's avatar Nghia Truong

REFAC: Change PointSetToVolumeMeshCD to PointSetToSurfaceMeshCD

parent e2be2889
......@@ -26,7 +26,7 @@
#include "imstkPointSetToCapsuleCD.h"
#include "imstkPointSetToSphereCD.h"
#include "imstkPointSetToPlaneCD.h"
#include "imstkPointSetToVolumeMeshCD.h"
#include "imstkPointSetToSurfaceMeshCD.h"
#include "imstkPointSetToSpherePickingCD.h"
// Mesh to mesh
......@@ -95,12 +95,12 @@ CollisionDetection::makeCollisionDetectionObject(const Type
IMSTK_CHECK_FOR_VALID_GEOMETRIES(pointset, sphere)
return std::make_shared<PointSetToSpherePickingCD>(pointset, sphere, colData);
}
case Type::PointSetToVolumeMesh:
case Type::PointSetToSurfaceMesh:
{
auto pointset = std::dynamic_pointer_cast<PointSet>(objA->getCollidingGeometry());
auto triMesh = std::dynamic_pointer_cast<SurfaceMesh>(objB->getCollidingGeometry());
IMSTK_CHECK_FOR_VALID_GEOMETRIES(pointset, triMesh)
return std::make_shared<PointSetToVolumeMeshCD>(pointset, triMesh, colData);
return std::make_shared<PointSetToSurfaceMeshCD>(pointset, triMesh, colData);
}
// Mesh to mesh
case Type::SurfaceMeshToSurfaceMesh:
......
......@@ -47,7 +47,7 @@ public:
PointSetToPlane,
PointSetToCapsule,
PointSetToSpherePicking,
PointSetToVolumeMesh,
PointSetToSurfaceMesh,
// Mesh to mesh (mesh to analytical object = mesh vertices to analytical object)
SurfaceMeshToSurfaceMesh,
......
......@@ -19,7 +19,7 @@
=========================================================================*/
#include "imstkPointSetToVolumeMeshCD.h"
#include "imstkPointSetToSurfaceMeshCD.h"
#include "imstkNarrowPhaseCD.h"
#include "imstkCollisionData.h"
#include "imstkParallelUtils.h"
......@@ -28,21 +28,21 @@
namespace imstk
{
PointSetToVolumeMeshCD::PointSetToVolumeMeshCD(std::shared_ptr<PointSet> pointset,
std::shared_ptr<SurfaceMesh> triMesh,
std::shared_ptr<CollisionData> colData) :
CollisionDetection(CollisionDetection::Type::PointSetToVolumeMesh, colData),
PointSetToSurfaceMeshCD::PointSetToSurfaceMeshCD(std::shared_ptr<PointSet> pointset,
std::shared_ptr<SurfaceMesh> triMesh,
std::shared_ptr<CollisionData> colData) :
CollisionDetection(CollisionDetection::Type::PointSetToSurfaceMesh, colData),
m_pointset(pointset), m_triMesh(triMesh)
{
}
void
PointSetToVolumeMeshCD::computeCollisionData()
PointSetToSurfaceMeshCD::computeCollisionData()
{
m_colData->clearAll();
// This is brute force collision detection
// TODO: replace by octree
// \todo replace by octree
ParallelUtils::parallelFor(static_cast<unsigned int>(m_pointset->getVertexPositions().size()),
[&](const unsigned int idx)
{
......
......@@ -26,25 +26,25 @@
namespace imstk
{
class Geometry;
class PointSet;
class SurfaceMesh;
struct CollisionData;
///
/// \class PointSetToTriMeshCD
/// \class PointSetToSurfaceMeshCD
///
/// \brief PointSet to sphere collision detection
/// \brief PointSet to surface mesh collision detection
///
class PointSetToVolumeMeshCD : public CollisionDetection
class PointSetToSurfaceMeshCD : public CollisionDetection
{
public:
///
/// \brief Constructor
///
PointSetToVolumeMeshCD(std::shared_ptr<PointSet> pointset,
std::shared_ptr<SurfaceMesh> triMesh,
std::shared_ptr<CollisionData> colData);
PointSetToSurfaceMeshCD(std::shared_ptr<PointSet> pointset,
std::shared_ptr<SurfaceMesh> triMesh,
std::shared_ptr<CollisionData> colData);
///
/// \brief Detect collision and compute collision data
......
......@@ -40,7 +40,7 @@ SurfaceMeshToSurfaceMeshCD::computeCollisionData()
m_colData->clearAll();
// This is brute force collision detection
// TODO: use octree
// \todo use octree
ParallelUtils::parallelFor(static_cast<unsigned int>(m_meshA->getNumTriangles()),
[&](const unsigned int idx1)
{
......
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