diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade10.dae.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade10.dae.sha512 new file mode 100644 index 0000000000000000000000000000000000000000..01dc30b00c55a3b5c2fc4c20c55cc238ad061f13 --- /dev/null +++ b/Data/Surgical Instruments/Scalpel/Scalpel_Blade10.dae.sha512 @@ -0,0 +1 @@ +de81db98099d447f73a068553b91cf13b86067126a0f356248325cd9bbcdae466405b6eca7dce5b874de7dfc11979270fe53622437a3ee65b8182bd86e96c5b7 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade10.obj.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade10.obj.sha512 deleted file mode 100644 index 4d0197c17e91a3af9101aff5b126a33e527dee41..0000000000000000000000000000000000000000 --- a/Data/Surgical Instruments/Scalpel/Scalpel_Blade10.obj.sha512 +++ /dev/null @@ -1 +0,0 @@ -b3020f808f1589756d438d689bfde4ef673a3ab51f93f699bb7c16dbefc21fd48bdd5660810c509f5bfa4256bb4fa2aa8955c3b59ca011e24c72414890291616 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade10_Hull.stl.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade10_Hull.stl.sha512 deleted file mode 100644 index 034890c59bc0acf07d468a2df98bf4f7a7f59fcd..0000000000000000000000000000000000000000 --- a/Data/Surgical Instruments/Scalpel/Scalpel_Blade10_Hull.stl.sha512 +++ /dev/null @@ -1 +0,0 @@ -3314f75a94b2ea8b026053678f3754e5203dd90b35e80f99e4ae83f38957461b9ab0f4fbb60c94240f3e6622a99ee4a1929e8d98b29e02b894c03da9a716f4c9 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade11.dae.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade11.dae.sha512 new file mode 100644 index 0000000000000000000000000000000000000000..377bd0efebd20830a5ed958d286562783a986b92 --- /dev/null +++ b/Data/Surgical Instruments/Scalpel/Scalpel_Blade11.dae.sha512 @@ -0,0 +1 @@ +35de8f05bdb4e0ae0e93c4caea21d3644fdcaa59a607e2a1e6bbcda76e0dbeabf364ad39dbd747b3e2ee1776e9cc1a938903f0c216e64f6ceaec85e5a4c59e43 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade11.obj.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade11.obj.sha512 deleted file mode 100644 index 6f0e02f90ebf77c320736922db2c8a09e9ee35fb..0000000000000000000000000000000000000000 --- a/Data/Surgical Instruments/Scalpel/Scalpel_Blade11.obj.sha512 +++ /dev/null @@ -1 +0,0 @@ -a68a897914f25b37381a833da42e1efd6242f3f43b3f3be3d53662151e41819a3b467d86884e199933364a5e3e09fe3999dd763b8ee9282cdd9e664f9ba1cf66 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade15.dae.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade15.dae.sha512 new file mode 100644 index 0000000000000000000000000000000000000000..edc06ca89e9d05b803081cecf2a195ad22a9ff3f --- /dev/null +++ b/Data/Surgical Instruments/Scalpel/Scalpel_Blade15.dae.sha512 @@ -0,0 +1 @@ +632f9e33d3279c8116ead86c785fb5758229b477169233f2eb92c3c7ebd796c0f68abdb18a5e0b10b42d6e540931319cc0a5419d8a57f5fab96c2ece0976a48b \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Blade15.obj.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Blade15.obj.sha512 deleted file mode 100644 index 85bace8d1d48801ab5bd52ac739552d7d6b66c8a..0000000000000000000000000000000000000000 --- a/Data/Surgical Instruments/Scalpel/Scalpel_Blade15.obj.sha512 +++ /dev/null @@ -1 +0,0 @@ -53c94e1d26114f36ad553fa6de26d6bdd1d9ccb7b693b4560ac25a520ce60f17fbd5819aba5d7c7580ca2c1875665439744b39f6f3a530138f2af9409a110f37 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Handle.dae.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Handle.dae.sha512 new file mode 100644 index 0000000000000000000000000000000000000000..b5a0ee44b9858925af65f662d2e6dd74aad8138c --- /dev/null +++ b/Data/Surgical Instruments/Scalpel/Scalpel_Handle.dae.sha512 @@ -0,0 +1 @@ +1dfb0e86575555b41abfabdf456fc614036f7acfc7034456e17fe91e7c91d04b888d2084c425127bde4adf9b2d9e292d360682468f9839a6f7be53b9b44f7171 \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Handle.obj.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Handle.obj.sha512 deleted file mode 100644 index 8e87f96ea38351bdcf2829fdb54a10d85ed1dd99..0000000000000000000000000000000000000000 --- a/Data/Surgical Instruments/Scalpel/Scalpel_Handle.obj.sha512 +++ /dev/null @@ -1 +0,0 @@ -5bfa843d28651bf9e1573d627434905ca7980541877c9a2aa3cd24d3c85f914245a416340de3d22cdeba73d641daf23d7aab9be753072c7c40e875f688ce506a \ No newline at end of file diff --git a/Data/Surgical Instruments/Scalpel/Scalpel_Hull_Subdivided.stl.sha512 b/Data/Surgical Instruments/Scalpel/Scalpel_Hull_Subdivided.stl.sha512 new file mode 100644 index 0000000000000000000000000000000000000000..030e837addcc86ed1ea53f3c23a4672e725fe622 --- /dev/null +++ b/Data/Surgical Instruments/Scalpel/Scalpel_Hull_Subdivided.stl.sha512 @@ -0,0 +1 @@ +43595d92c9f570a2a35f1bde65239335efc4ffb5625bd3416e0d5023b7e07b34f8e430e1d09c986a05cb8cdfc35e58d1813e969eed685b72f9865eaade52e1e0 \ No newline at end of file diff --git a/Examples/Interactions/LevelSet-Rigid/LevelSet-RigidInteractionExample.cpp b/Examples/Interactions/LevelSet-Rigid/LevelSet-RigidInteractionExample.cpp index 49e6e842746aa20a08dcf1a75cd2bdc351eda145..199f61cf451381135995bb6cb7a66e82b0eddb20 100644 --- a/Examples/Interactions/LevelSet-Rigid/LevelSet-RigidInteractionExample.cpp +++ b/Examples/Interactions/LevelSet-Rigid/LevelSet-RigidInteractionExample.cpp @@ -24,6 +24,7 @@ #include "imstkHapticDeviceClient.h" #include "imstkHapticDeviceManager.h" #include "imstkImageData.h" +#include "imstkIsometricMap.h" #include "imstkKeyboardSceneControl.h" #include "imstkLevelSetCH.h" #include "imstkLevelSetDeformableObject.h" @@ -133,26 +134,44 @@ makeRigidObj(const std::string& name) imstkNew<RigidObject2> rigidObj("Cube"); { - auto toolMesh = MeshIO::read<SurfaceMesh>("C:/Users/Andx_/Desktop/testMesh.stl"); + auto toolMesh = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/Scalpel_Hull_Subdivided.stl"); toolMesh->rotate(Vec3d(0.0, 1.0, 0.0), 3.14, Geometry::TransformType::ApplyToData); toolMesh->rotate(Vec3d(1.0, 0.0, 0.0), -1.57, Geometry::TransformType::ApplyToData); toolMesh->scale(Vec3d(0.07, 0.07, 0.07), Geometry::TransformType::ApplyToData); - imstkNew<VisualModel> visualModel(toolMesh); - imstkNew<RenderMaterial> mat; - mat->setDisplayMode(RenderMaterial::DisplayMode::Surface); - mat->setShadingModel(RenderMaterial::ShadingModel::PBR); - mat->setMetalness(0.9f); - mat->setRoughness(0.4f); - //mat->setDisplayMode(RenderMaterial::DisplayMode::Points); - //mat->setPointSize(15.0); - mat->setDiffuseColor(Color(0.7, 0.7, 0.7)); - visualModel->setRenderMaterial(mat); + auto toolVisualMeshHandle = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/Scalpel_Handle.dae"); + toolVisualMeshHandle->rotate(Vec3d(0.0, 1.0, 0.0), 3.14, Geometry::TransformType::ApplyToData); + toolVisualMeshHandle->rotate(Vec3d(1.0, 0.0, 0.0), -1.57, Geometry::TransformType::ApplyToData); + toolVisualMeshHandle->scale(Vec3d(0.07, 0.07, 0.07), Geometry::TransformType::ApplyToData); + + auto toolVisualMeshBlade = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/Scalpel_Blade10.dae"); + toolVisualMeshBlade->rotate(Vec3d(0.0, 1.0, 0.0), 3.14, Geometry::TransformType::ApplyToData); + toolVisualMeshBlade->rotate(Vec3d(1.0, 0.0, 0.0), -1.57, Geometry::TransformType::ApplyToData); + toolVisualMeshBlade->scale(Vec3d(0.07, 0.07, 0.07), Geometry::TransformType::ApplyToData); + + imstkNew<RenderMaterial> toolMaterial; + toolMaterial->setDisplayMode(RenderMaterial::DisplayMode::Surface); + toolMaterial->setShadingModel(RenderMaterial::ShadingModel::PBR); + toolMaterial->setMetalness(0.9f); + toolMaterial->setRoughness(0.4f); + //toolMaterial->setDisplayMode(RenderMaterial::DisplayMode::Points); + //toolMaterial->setPointSize(15.0); + toolMaterial->setDiffuseColor(Color(0.7, 0.7, 0.7)); + + imstkNew<VisualModel> visualModel1(toolVisualMeshHandle); + visualModel1->setRenderMaterial(toolMaterial); + rigidObj->addVisualModel(visualModel1); + + imstkNew<VisualModel> visualModel2(toolVisualMeshBlade); + visualModel2->setRenderMaterial(toolMaterial); + rigidObj->addVisualModel(visualModel2); // Create the object - rigidObj->addVisualModel(visualModel); rigidObj->setPhysicsGeometry(toolMesh); rigidObj->setCollidingGeometry(toolMesh); + rigidObj->setPhysicsToVisualMap(std::make_shared<IsometricMap>(toolMesh, toolVisualMeshHandle)); + // Hack to add two maps + rigidObj->setPhysicsToCollidingMap(std::make_shared<IsometricMap>(toolMesh, toolVisualMeshBlade)); rigidObj->setDynamicalModel(rbdModel); rigidObj->getRigidBody()->m_mass = 1000.0; //rigidObj->getRigidBody()->setInertiaFromPointSet(toolMesh, 0.01, false); @@ -200,7 +219,7 @@ main() colHandlerB->setLevelSetVelocityScaling(0.1); colHandlerB->setKernel(3, 1.0); //colHandlerB->setLevelSetVelocityScaling(0.0); // Can't push the levelset - colHandlerB->setUseProportionalVelocity(true); + colHandlerB->setUseProportionalVelocity(false); scene->getCollisionGraph()->addInteraction(interaction); // Light (white) diff --git a/Examples/OpenVRController/OpenVRControllerExample.cpp b/Examples/OpenVRController/OpenVRControllerExample.cpp index ed7d017bd4583e60c590190f30ae6917db49c5ed..166c86cbc109cf8322502e2d2911061cb48f8b00 100644 --- a/Examples/OpenVRController/OpenVRControllerExample.cpp +++ b/Examples/OpenVRController/OpenVRControllerExample.cpp @@ -42,7 +42,7 @@ std::shared_ptr<SceneObject> makeHandleObject() { imstkNew<SceneObject> scalpelHandle("ScalpelHandle"); - auto toolHandleMesh = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/Scalpel_Handle.obj"); + auto toolHandleMesh = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/Scalpel_Handle.dae"); toolHandleMesh->translate(0.0, 0.0, 1.0, Geometry::TransformType::ApplyToData); toolHandleMesh->rotate(Vec3d(0.0, 1.0, 0.0), 3.14, Geometry::TransformType::ApplyToData); toolHandleMesh->rotate(Vec3d(1.0, 0.0, 0.0), -1.57, Geometry::TransformType::ApplyToData); @@ -68,7 +68,7 @@ std::shared_ptr<SceneObject> makeBlade(std::string filename) { imstkNew<SceneObject> scalpelBlade(filename); - auto blade10Mesh = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/" + filename + ".obj"); + auto blade10Mesh = MeshIO::read<SurfaceMesh>(iMSTK_DATA_ROOT "/Surgical Instruments/Scalpel/" + filename + ".dae"); blade10Mesh->translate(0.0, 0.0, 1.0, Geometry::TransformType::ApplyToData); blade10Mesh->rotate(Vec3d(0.0, 1.0, 0.0), 3.14, Geometry::TransformType::ApplyToData); blade10Mesh->rotate(Vec3d(1.0, 0.0, 0.0), -1.57, Geometry::TransformType::ApplyToData); diff --git a/Source/GeometryMappers/imstkIsometricMap.cpp b/Source/GeometryMappers/imstkIsometricMap.cpp index 9252f25a4a55b3143264ef20ca3ad3062196a216..d2b44f5524c5d76bf5d99be0902a0b6125024cc3 100644 --- a/Source/GeometryMappers/imstkIsometricMap.cpp +++ b/Source/GeometryMappers/imstkIsometricMap.cpp @@ -41,23 +41,6 @@ IsometricMap::apply() return; } - // Set the follower mesh configuration to that of master - m_slave->setTranslation(m_master->getTranslation()); - m_slave->setRotation(m_master->getRotation()); - - // Apply the offset transform - m_slave->transform(m_rigidTransform.matrix()); -} - -void -IsometricMap::setTransform(const RigidTransform3d& affineTransform) -{ - m_rigidTransform = affineTransform; -} - -const RigidTransform3d& -IsometricMap::getTransform() const -{ - return m_rigidTransform; + m_slave->setTransform(m_master->getTransform()); } } // imstk diff --git a/Source/GeometryMappers/imstkIsometricMap.h b/Source/GeometryMappers/imstkIsometricMap.h index f097b17fb7d5d9243942cbf249c1168e7b2c6c89..d5fe48cc9c263ea06e6f4ae9ec67866db42d5e34 100644 --- a/Source/GeometryMappers/imstkIsometricMap.h +++ b/Source/GeometryMappers/imstkIsometricMap.h @@ -39,22 +39,20 @@ public: /// \brief Constructor /// IsometricMap() : - GeometryMap(GeometryMap::Type::Isometric), - m_rigidTransform(RigidTransform3d::Identity()) - {} + GeometryMap(GeometryMap::Type::Isometric) + { } /// /// \brief Constructor /// IsometricMap(std::shared_ptr<Geometry> master, std::shared_ptr<Geometry> slave) : - GeometryMap(master, slave, GeometryMap::Type::Isometric), - m_rigidTransform(RigidTransform3d::Identity()) - {} + GeometryMap(master, slave, GeometryMap::Type::Isometric) + { } /// /// \brief Destructor /// - ~IsometricMap() = default; + ~IsometricMap() override = default; /// /// \brief Compute the map @@ -72,20 +70,6 @@ public: inline bool isValid() const override { return true; - }; - - /// - /// \brief Set the transform - /// - void setTransform(const RigidTransform3d& affineTransform); - - /// - /// \brief Get the transform - /// - const RigidTransform3d& getTransform() const; - -protected: - - RigidTransform3d m_rigidTransform; ///> Rigid transform + } }; } // imstk diff --git a/Source/SceneEntities/Objects/imstkDynamicObject.cpp b/Source/SceneEntities/Objects/imstkDynamicObject.cpp index a7af8bc391c74d4c2c2a93db8a85d3088817cbe7..fe6ed4453256d6348ef975ec739ed2c8a5ed7f8e 100644 --- a/Source/SceneEntities/Objects/imstkDynamicObject.cpp +++ b/Source/SceneEntities/Objects/imstkDynamicObject.cpp @@ -67,6 +67,7 @@ DynamicObject::updatePhysicsGeometry() if (m_physicsToCollidingGeomMap) { m_physicsToCollidingGeomMap->apply(); + m_physicsToCollidingGeomMap->getSlave()->modified(); } if (m_physicsGeometry != nullptr)