From 0cf1e0f8123a4a028eb9b4ff07ff6591fd47b4c0 Mon Sep 17 00:00:00 2001 From: sreekanth-arikatla <sreekanth.arikatla@kitware.com> Date: Tue, 29 Jun 2021 08:42:10 -0400 Subject: [PATCH] REFAC: Remove apiutils --- CMakeLists.txt | 1 - Examples/BoneShaving/CMakeLists.txt | 3 +- Examples/CameraController/CMakeLists.txt | 2 +- .../ManualCDWithOctree/CMakeLists.txt | 2 +- Examples/CreateEnclosingMesh/CMakeLists.txt | 2 +- Examples/DebugRendering/CMakeLists.txt | 2 +- Examples/DeformableBody/CMakeLists.txt | 2 +- Examples/GeometryProcessing/CMakeLists.txt | 2 +- Examples/GeometryTransforms/CMakeLists.txt | 2 +- .../GeometryTransformsExample.cpp | 11 +- Examples/ObjectController/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- Examples/Octree/CMakeLists.txt | 2 +- Examples/PBD/PBDCloth/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../PBD/PBDCollisionOneObject/CMakeLists.txt | 2 +- .../PBD/PBDCollisionStairs/CMakeLists.txt | 2 +- .../PBD/PBDDeformableObject/CMakeLists.txt | 2 +- Examples/PBDCutting/CMakeLists.txt | 2 +- Examples/PBDPicking/CMakeLists.txt | 2 +- Examples/RCM/CMakeLists.txt | 2 +- Examples/Rendering/CMakeLists.txt | 2 +- Examples/Rendering/RenderingExample.cpp | 12 +- .../SPHFluid/SPHFluid-BallDrop/CMakeLists.txt | 2 +- .../SPHFluid-BunnyShape/CMakeLists.txt | 2 +- .../SPHFluid-HighViscousity/CMakeLists.txt | 2 +- Examples/SceneManagement/CMakeLists.txt | 2 +- Examples/Screenshot/CMakeLists.txt | 2 +- .../TaskGraph/Configuration/CMakeLists.txt | 2 +- Examples/TaskGraph/TaskGraph/CMakeLists.txt | 2 +- Examples/TaskGraph/Timing/CMakeLists.txt | 2 +- Examples/VolumeRendering/CMakeLists.txt | 2 +- Source/Rendering/Testing/CMakeLists.txt | 2 +- Source/apiUtilities/CMakeLists.txt | 17 -- Source/apiUtilities/imstkAPIUtilities.cpp | 202 ------------------ Source/apiUtilities/imstkAPIUtilities.h | 80 ------- 36 files changed, 46 insertions(+), 338 deletions(-) delete mode 100644 Source/apiUtilities/CMakeLists.txt delete mode 100644 Source/apiUtilities/imstkAPIUtilities.cpp delete mode 100644 Source/apiUtilities/imstkAPIUtilities.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 58c703091..c74201620 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -371,7 +371,6 @@ add_subdirectory(Source/CollisionDetection) add_subdirectory(Source/CollisionHandling) add_subdirectory(Source/Scene) add_subdirectory(Source/SimulationManager) -add_subdirectory(Source/apiUtilities) add_subdirectory(Source/Filtering) add_subdirectory(Source/FilteringCore) diff --git a/Examples/BoneShaving/CMakeLists.txt b/Examples/BoneShaving/CMakeLists.txt index be6b047df..f5951b4c7 100644 --- a/Examples/BoneShaving/CMakeLists.txt +++ b/Examples/BoneShaving/CMakeLists.txt @@ -36,11 +36,10 @@ if(iMSTK_USE_OpenHaptics) if(UNIX) target_link_libraries(${PROJECT_NAME} SimulationManager - apiUtilities) + ) else() target_link_libraries(${PROJECT_NAME} SimulationManager - apiUtilities SFML) endif() diff --git a/Examples/CameraController/CMakeLists.txt b/Examples/CameraController/CMakeLists.txt index 797e22381..e3ae4737f 100644 --- a/Examples/CameraController/CMakeLists.txt +++ b/Examples/CameraController/CMakeLists.txt @@ -32,7 +32,7 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) + target_link_libraries(${PROJECT_NAME} SimulationManager) #----------------------------------------------------------------------------- # Associate external data diff --git a/Examples/CollisionDetection/ManualCDWithOctree/CMakeLists.txt b/Examples/CollisionDetection/ManualCDWithOctree/CMakeLists.txt index 743d27f30..6e0a1accc 100644 --- a/Examples/CollisionDetection/ManualCDWithOctree/CMakeLists.txt +++ b/Examples/CollisionDetection/ManualCDWithOctree/CMakeLists.txt @@ -35,4 +35,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/CreateEnclosingMesh/CMakeLists.txt b/Examples/CreateEnclosingMesh/CMakeLists.txt index 9c6583491..a3174ed86 100644 --- a/Examples/CreateEnclosingMesh/CMakeLists.txt +++ b/Examples/CreateEnclosingMesh/CMakeLists.txt @@ -31,5 +31,5 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} apiUtilities) +target_link_libraries(${PROJECT_NAME} Common SimulationManager SceneEntities) diff --git a/Examples/DebugRendering/CMakeLists.txt b/Examples/DebugRendering/CMakeLists.txt index fd3197b43..eb4ecf407 100644 --- a/Examples/DebugRendering/CMakeLists.txt +++ b/Examples/DebugRendering/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/DeformableBody/CMakeLists.txt b/Examples/DeformableBody/CMakeLists.txt index 503966058..104d32fcb 100644 --- a/Examples/DeformableBody/CMakeLists.txt +++ b/Examples/DeformableBody/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/GeometryProcessing/CMakeLists.txt b/Examples/GeometryProcessing/CMakeLists.txt index 0abe14903..3baf12ddb 100644 --- a/Examples/GeometryProcessing/CMakeLists.txt +++ b/Examples/GeometryProcessing/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities Filtering) +target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) diff --git a/Examples/GeometryTransforms/CMakeLists.txt b/Examples/GeometryTransforms/CMakeLists.txt index 412eb8054..fdd23f2a2 100644 --- a/Examples/GeometryTransforms/CMakeLists.txt +++ b/Examples/GeometryTransforms/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/GeometryTransforms/GeometryTransformsExample.cpp b/Examples/GeometryTransforms/GeometryTransformsExample.cpp index 287d5f2e7..e5ad0e3b1 100644 --- a/Examples/GeometryTransforms/GeometryTransformsExample.cpp +++ b/Examples/GeometryTransforms/GeometryTransformsExample.cpp @@ -19,7 +19,6 @@ =========================================================================*/ -#include "imstkAPIUtilities.h" #include "imstkCamera.h" #include "imstkCylinder.h" #include "imstkKeyboardSceneControl.h" @@ -29,6 +28,8 @@ #include "imstkNew.h" #include "imstkOrientedBox.h" #include "imstkPlane.h" +#include "imstkSurfaceMesh.h" +#include "imstkMeshIO.h" #include "imstkRenderMaterial.h" #include "imstkScene.h" #include "imstkSceneManager.h" @@ -50,9 +51,11 @@ main() imstkNew<Scene> scene("GeometryTransforms"); - auto sceneObj = apiutils::createAndAddVisualSceneObject(scene, iMSTK_DATA_ROOT "/asianDragon/asianDragon.obj", "Dragon"); - - CHECK(sceneObj != nullptr) << "ERROR: Unable to create scene object"; + // Create object and add to scene + auto SurfaceMesh = std::dynamic_pointer_cast<imstk::SurfaceMesh>(MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.obj")); + auto sceneObj = std::make_shared<SceneObject>("Dragon"); + sceneObj->setVisualGeometry(SurfaceMesh); + scene->addSceneObject(sceneObj); auto surfaceMesh = sceneObj->getVisualGeometry(); surfaceMesh->scale(5.0, Geometry::TransformType::ConcatenateToTransform); diff --git a/Examples/ObjectController/CMakeLists.txt b/Examples/ObjectController/CMakeLists.txt index bbc831bfa..f4d400d5f 100644 --- a/Examples/ObjectController/CMakeLists.txt +++ b/Examples/ObjectController/CMakeLists.txt @@ -32,6 +32,6 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) + target_link_libraries(${PROJECT_NAME} SimulationManager) endif() diff --git a/Examples/ObjectControllerDummyClient/CMakeLists.txt b/Examples/ObjectControllerDummyClient/CMakeLists.txt index 248fcb43e..1448cc638 100644 --- a/Examples/ObjectControllerDummyClient/CMakeLists.txt +++ b/Examples/ObjectControllerDummyClient/CMakeLists.txt @@ -31,5 +31,5 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/Octree/CMakeLists.txt b/Examples/Octree/CMakeLists.txt index bfca94999..98f95d91c 100644 --- a/Examples/Octree/CMakeLists.txt +++ b/Examples/Octree/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/PBD/PBDCloth/CMakeLists.txt b/Examples/PBD/PBDCloth/CMakeLists.txt index 8e1aec619..db0500ae6 100644 --- a/Examples/PBD/PBDCloth/CMakeLists.txt +++ b/Examples/PBD/PBDCloth/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/PBD/PBDCollisionMultipleObjects/CMakeLists.txt b/Examples/PBD/PBDCollisionMultipleObjects/CMakeLists.txt index 6d57c6b70..8466f312f 100644 --- a/Examples/PBD/PBDCollisionMultipleObjects/CMakeLists.txt +++ b/Examples/PBD/PBDCollisionMultipleObjects/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities ) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/PBD/PBDCollisionOneObject/CMakeLists.txt b/Examples/PBD/PBDCollisionOneObject/CMakeLists.txt index 2e02b8664..d6454dd97 100644 --- a/Examples/PBD/PBDCollisionOneObject/CMakeLists.txt +++ b/Examples/PBD/PBDCollisionOneObject/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/PBD/PBDCollisionStairs/CMakeLists.txt b/Examples/PBD/PBDCollisionStairs/CMakeLists.txt index c0c0bf8fc..e0c408bb0 100644 --- a/Examples/PBD/PBDCollisionStairs/CMakeLists.txt +++ b/Examples/PBD/PBDCollisionStairs/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} SimulationManager) \ No newline at end of file diff --git a/Examples/PBD/PBDDeformableObject/CMakeLists.txt b/Examples/PBD/PBDDeformableObject/CMakeLists.txt index b677e9e8f..022b4d101 100644 --- a/Examples/PBD/PBDDeformableObject/CMakeLists.txt +++ b/Examples/PBD/PBDDeformableObject/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/PBD) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/PBDCutting/CMakeLists.txt b/Examples/PBDCutting/CMakeLists.txt index a2aff7945..573401da5 100644 --- a/Examples/PBDCutting/CMakeLists.txt +++ b/Examples/PBDCutting/CMakeLists.txt @@ -32,6 +32,6 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities Filtering) + target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) endif() diff --git a/Examples/PBDPicking/CMakeLists.txt b/Examples/PBDPicking/CMakeLists.txt index 17355b81f..26b5faa8e 100644 --- a/Examples/PBDPicking/CMakeLists.txt +++ b/Examples/PBDPicking/CMakeLists.txt @@ -32,6 +32,6 @@ if(iMSTK_USE_OpenHaptics) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- - target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) + target_link_libraries(${PROJECT_NAME} SimulationManager) endif() diff --git a/Examples/RCM/CMakeLists.txt b/Examples/RCM/CMakeLists.txt index 10814d1f3..2163379bb 100644 --- a/Examples/RCM/CMakeLists.txt +++ b/Examples/RCM/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} apiUtilities) +target_link_libraries(${PROJECT_NAME} Common SceneEntities) diff --git a/Examples/Rendering/CMakeLists.txt b/Examples/Rendering/CMakeLists.txt index badbc6763..b0b6a0069 100644 --- a/Examples/Rendering/CMakeLists.txt +++ b/Examples/Rendering/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/Rendering/RenderingExample.cpp b/Examples/Rendering/RenderingExample.cpp index 90633cd4e..9bad64fda 100644 --- a/Examples/Rendering/RenderingExample.cpp +++ b/Examples/Rendering/RenderingExample.cpp @@ -19,12 +19,12 @@ =========================================================================*/ -#include "imstkAPIUtilities.h" #include "imstkCamera.h" #include "imstkIBLProbe.h" #include "imstkKeyboardSceneControl.h" #include "imstkDirectionalLight.h" #include "imstkMeshIO.h" +#include "imstkPlane.h" #include "imstkMouseSceneControl.h" #include "imstkNew.h" #include "imstkRenderMaterial.h" @@ -89,10 +89,16 @@ main() scene->addLight("directionalLight", dirLight); // Plane - auto planeObj = apiutils::createVisualAnalyticalSceneObject("Plane", scene, "VisualPlane", Vec3d(10.0, 10.0, 10.0)); + auto plane = std::make_shared<Plane>(); + plane->translate(Vec3d(10.0, 10.0, 10.0), Geometry::TransformType::ApplyToData); + + auto sceneObj = std::make_shared<SceneObject>("VisualPlane"); + sceneObj->setVisualGeometry(plane); + scene->addSceneObject(sceneObj); + imstkNew<RenderMaterial> planeMaterial; planeMaterial->setColor(Color::LightGray); - planeObj->getVisualModel(0)->setRenderMaterial(planeMaterial); + sceneObj->getVisualModel(0)->setRenderMaterial(planeMaterial); } // Run the simulation diff --git a/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt b/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt index ff4b4fe83..e7e432803 100644 --- a/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt +++ b/Examples/SPHFluid/SPHFluid-BallDrop/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt b/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt index c735cd3a2..01c20d23d 100644 --- a/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt +++ b/Examples/SPHFluid/SPHFluid-BunnyShape/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt b/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt index 6166e288f..966b9f21b 100644 --- a/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt +++ b/Examples/SPHFluid/SPHFluid-HighViscousity/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/SPH) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/SceneManagement/CMakeLists.txt b/Examples/SceneManagement/CMakeLists.txt index 12c0da7d6..6c41f4ed7 100644 --- a/Examples/SceneManagement/CMakeLists.txt +++ b/Examples/SceneManagement/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/Screenshot/CMakeLists.txt b/Examples/Screenshot/CMakeLists.txt index 6493e5d75..6e901d9a1 100644 --- a/Examples/Screenshot/CMakeLists.txt +++ b/Examples/Screenshot/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/TaskGraph/Configuration/CMakeLists.txt b/Examples/TaskGraph/Configuration/CMakeLists.txt index 09512ba38..e52ad78a1 100644 --- a/Examples/TaskGraph/Configuration/CMakeLists.txt +++ b/Examples/TaskGraph/Configuration/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/TaskGraph) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/TaskGraph/TaskGraph/CMakeLists.txt b/Examples/TaskGraph/TaskGraph/CMakeLists.txt index e51e2e769..31d8fe23e 100644 --- a/Examples/TaskGraph/TaskGraph/CMakeLists.txt +++ b/Examples/TaskGraph/TaskGraph/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/TaskGraph) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/TaskGraph/Timing/CMakeLists.txt b/Examples/TaskGraph/Timing/CMakeLists.txt index ea4991855..77eb16496 100644 --- a/Examples/TaskGraph/Timing/CMakeLists.txt +++ b/Examples/TaskGraph/Timing/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples/TaskGraph) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities) +target_link_libraries(${PROJECT_NAME} SimulationManager) diff --git a/Examples/VolumeRendering/CMakeLists.txt b/Examples/VolumeRendering/CMakeLists.txt index 07db4511b..ba361d232 100644 --- a/Examples/VolumeRendering/CMakeLists.txt +++ b/Examples/VolumeRendering/CMakeLists.txt @@ -31,4 +31,4 @@ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES FOLDER Examples) #----------------------------------------------------------------------------- # Link libraries to executable #----------------------------------------------------------------------------- -target_link_libraries(${PROJECT_NAME} SimulationManager apiUtilities Filtering) +target_link_libraries(${PROJECT_NAME} SimulationManager Filtering) diff --git a/Source/Rendering/Testing/CMakeLists.txt b/Source/Rendering/Testing/CMakeLists.txt index 2b7b0a196..c6b875d6a 100644 --- a/Source/Rendering/Testing/CMakeLists.txt +++ b/Source/Rendering/Testing/CMakeLists.txt @@ -1,3 +1,3 @@ include(imstkAddTest) imstk_add_visual_test( Rendering ) - target_link_libraries( RenderingVisualTests apiUtilities ) \ No newline at end of file + target_link_libraries( RenderingVisualTests Common SimulationManager) \ No newline at end of file diff --git a/Source/apiUtilities/CMakeLists.txt b/Source/apiUtilities/CMakeLists.txt deleted file mode 100644 index 6990101b5..000000000 --- a/Source/apiUtilities/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -#----------------------------------------------------------------------------- -# Create target -#----------------------------------------------------------------------------- -include(imstkAddLibrary) -imstk_add_library(apiUtilities - DEPENDS - Common - SimulationManager - Scene - ) - -#----------------------------------------------------------------------------- -# Testing -#----------------------------------------------------------------------------- -#if( ${PROJECT_NAME}_BUILD_TESTING ) -# add_subdirectory( Testing ) -#endif() \ No newline at end of file diff --git a/Source/apiUtilities/imstkAPIUtilities.cpp b/Source/apiUtilities/imstkAPIUtilities.cpp deleted file mode 100644 index df74d14c9..000000000 --- a/Source/apiUtilities/imstkAPIUtilities.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/*========================================================================= - - Library: iMSTK - - Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, - & Imaging in Medicine, Rensselaer Polytechnic Institute. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ -#include "imstkAPIUtilities.h" -#include "imstkGraph.h" -#include "imstkLinearProjectionConstraint.h" -#include "imstkLogger.h" -#include "imstkVecDataArray.h" - -// Objects -#include "imstkCollidingObject.h" -#include "imstkFEMDeformableBodyModel.h" -#include "imstkScene.h" -#include "imstkSceneManager.h" - -// Geometry -#include "imstkCapsule.h" -#include "imstkOrientedBox.h" -#include "imstkImageData.h" -#include "imstkMeshIO.h" -#include "imstkPlane.h" -#include "imstkSphere.h" -#include "imstkSurfaceMesh.h" -#include "imstkTetrahedralMesh.h" - -namespace imstk -{ -namespace apiutils -{ -std::unordered_map<std::string, std::function<std::shared_ptr<Geometry>()>> geomMakeFunctions = -{ - { "Sphere", []() { return std::make_shared<Sphere>(); } }, - { "Plane", []() { return std::make_shared<Sphere>(); } }, - { "OrientedBox", []() { return std::make_shared<OrientedBox>(); } }, - { "Capsule", []() { return std::make_shared<Sphere>(); } }, - { "Cylinder", []() { return std::make_shared<Sphere>(); } } -}; - -/// -/// \brief Create a analytical visual scene object that and add it to the scene -/// -std::shared_ptr<SceneObject> -createVisualAnalyticalSceneObject(std::string type, - std::shared_ptr<Scene> scene, - const std::string& objName, - const Vec3d scale /* = 1.*/, - const Vec3d t /*= Vec3d(0., 0., 0.)*/) -{ - CHECK(scene != nullptr) << "Error: Scene object is not valid!"; - CHECK(!objName.empty()) << "Error: Name is empty!"; - - if (geomMakeFunctions.count(type) == 0) - { - LOG(WARNING) << "Scene object geometry type " << type << " is not analytical!"; - return nullptr; - } - std::shared_ptr<Geometry> geom = geomMakeFunctions[type](); - - geom->scale(scale, Geometry::TransformType::ApplyToData); - geom->translate(t, Geometry::TransformType::ApplyToData); - - auto sceneObj = std::make_shared<SceneObject>(objName); - sceneObj->setVisualGeometry(geom); - scene->addSceneObject(sceneObj); - - return sceneObj; -} - -/// -/// \brief Create a analytical colliding scene object that and add it to the scene -/// -std::shared_ptr<CollidingObject> -createCollidingAnalyticalSceneObject(std::string type, - std::shared_ptr<Scene> scene, - const std::string& objName, - const Vec3d scale /*= 1.*/, - const Vec3d t /*= Vec3d(0., 0., 0.)*/) -{ - CHECK(scene != nullptr) << "Scene is not valid!"; - CHECK(!objName.empty()) << "Name is empty!"; - - if (geomMakeFunctions.count(type) == 0) - { - LOG(WARNING) << "Scene object geometry type " << type << " is not analytical!"; - return nullptr; - } - std::shared_ptr<Geometry> geom = geomMakeFunctions[type](); - - geom->scale(scale, Geometry::TransformType::ApplyToData); - geom->translate(t, Geometry::TransformType::ApplyToData); - - auto sceneObj = std::make_shared<CollidingObject>(objName); - sceneObj->setVisualGeometry(geom); - sceneObj->setCollidingGeometry(geom); - scene->addSceneObject(sceneObj); - - return sceneObj; -} - -/// -/// \brief Read a mesh, create a visual scene object and add to the scene -/// -std::shared_ptr<SceneObject> -createAndAddVisualSceneObject(std::shared_ptr<Scene> scene, - const std::string& fileName, - const std::string& objectName) -{ - CHECK(scene != nullptr) << "Error: Scene object supplied is not valid!"; - CHECK(!fileName.empty()) << "Error: Name is empty!"; - - auto mesh = MeshIO::read(fileName); - auto SurfaceMesh = std::dynamic_pointer_cast<imstk::SurfaceMesh>(mesh); - - // Create object and add to scene - auto meshSceneObject = std::make_shared<SceneObject>("meshObject"); - meshSceneObject->setVisualGeometry(SurfaceMesh); - meshSceneObject->setName(objectName); - scene->addSceneObject(meshSceneObject); - - return meshSceneObject; -} - -/// -/// \brief Create a non-linear system using FEM dynamic model -/// -std::shared_ptr<NonLinearSystem<SparseMatrixd>> -createNonLinearSystem(std::shared_ptr<FEMDeformableBodyModel> dynaModel) -{ - CHECK(dynaModel != nullptr) << "Dynamic model object supplied is not valid!"; - - auto nlSystem = std::make_shared<NonLinearSystem<SparseMatrixd>>( - dynaModel->getFunction(), - dynaModel->getFunctionGradient()); - - std::vector<LinearProjectionConstraint> linProj; - for (auto i : dynaModel->getFixNodeIds()) - { - linProj.push_back(LinearProjectionConstraint(i, true)); - } - nlSystem->setUnknownVector(dynaModel->getUnknownVec()); - nlSystem->setUpdateFunction(dynaModel->getUpdateFunction()); - nlSystem->setUpdatePreviousStatesFunction(dynaModel->getUpdatePrevStateFunction()); - - return nlSystem; -} - -std::shared_ptr<Graph> -getMeshGraph(std::shared_ptr<PointSet> m) -{ - LOG(WARNING) << "Note: The graph of a point set has no edges"; - - return std::make_shared<Graph>(m->getNumVertices()); -} - -std::shared_ptr<Graph> -getMeshGraph(std::shared_ptr<SurfaceMesh> m) -{ - auto gMesh = std::make_shared<Graph>(m->getNumVertices()); - for (auto tri : *m->getTriangleIndices()) - { - gMesh->addEdge(tri[0], tri[1]); - gMesh->addEdge(tri[0], tri[2]); - gMesh->addEdge(tri[1], tri[2]); - } - - return gMesh; -} - -std::shared_ptr<Graph> -getMeshGraph(std::shared_ptr<TetrahedralMesh> m) -{ - auto gMesh = std::make_shared<Graph>(m->getNumVertices()); - for (auto tet : *m->getTetrahedraIndices()) - { - gMesh->addEdge(tet[0], tet[1]); - gMesh->addEdge(tet[0], tet[2]); - gMesh->addEdge(tet[0], tet[3]); - gMesh->addEdge(tet[1], tet[2]); - gMesh->addEdge(tet[1], tet[3]); - gMesh->addEdge(tet[2], tet[3]); - } - return gMesh; -} -} //apiutils -} // imstk diff --git a/Source/apiUtilities/imstkAPIUtilities.h b/Source/apiUtilities/imstkAPIUtilities.h deleted file mode 100644 index c0b9ed9b2..000000000 --- a/Source/apiUtilities/imstkAPIUtilities.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - - Library: iMSTK - - Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, - & Imaging in Medicine, Rensselaer Polytechnic Institute. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ - -#pragma once - -#include "imstkGeometry.h" -#include "imstkMath.h" - -namespace imstk -{ -class CollidingObject; -class FEMDeformableBodyModel; -class Graph; -template<typename Matrix> -class NonLinearSystem; -class PointSet; -class Scene; -class SceneManager; -class SceneObject; -class SurfaceMesh; -class TetrahedralMesh; - -namespace apiutils -{ -/// -/// \brief Create a analytical visual scene object that and add it to the scene -/// -std::shared_ptr<SceneObject> createVisualAnalyticalSceneObject(std::string type, - std::shared_ptr<Scene> scene, - const std::string& objName, - const Vec3d scale = Vec3d(1.0, 1.0, 1.0), - const Vec3d t = Vec3d(0., 0., 0.)); - -/// -/// \brief Create a analytical colliding scene object that and add it to the scene -/// -std::shared_ptr<CollidingObject> createCollidingAnalyticalSceneObject(std::string type, - std::shared_ptr<Scene> scene, - const std::string& objName, - const Vec3d scale = Vec3d(1.0, 1.0, 1.0), - const Vec3d t = Vec3d(0., 0., 0.)); - -/// -/// \brief Read a mesh, create a visual scene object and add to the scene -/// -std::shared_ptr<SceneObject> createAndAddVisualSceneObject(std::shared_ptr<Scene> scene, - const std::string& fileName, - const std::string& objectName); - -/// -/// \brief Create a non-linear system using FEM dynamic model -/// -std::shared_ptr<NonLinearSystem<SparseMatrixd>> createNonLinearSystem(std::shared_ptr<FEMDeformableBodyModel> dynaModel); - -/// -/// \brief Create a \ref Graph ref -/// -std::shared_ptr<Graph> getMeshGraph(std::shared_ptr<PointSet> m); -std::shared_ptr<Graph> getMeshGraph(std::shared_ptr<SurfaceMesh> m); -std::shared_ptr<Graph> getMeshGraph(std::shared_ptr<TetrahedralMesh> m); -} //apiutils -} // imstk -- GitLab