diff --git a/CMakeLists.txt b/CMakeLists.txt index 58c7030918f8a11e142e7c88f492b2a8f9b53799..c742016207820cac157f6969796e2d5648feb1c5 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 be6b047dfb1ac1f3d083b81b965095c9138309f6..f5951b4c7d0a6f4ac71c05f4500202a9c295a264 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 797e223819a63eb3c25cc1e87e6d73669c94ddf5..e3ae4737fdd8a87228abcfee79493899f43255d8 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 743d27f306899765bf4ae373a5a262e7edb7223d..6e0a1accc3fba72480f10dd137a52bc0d78fd94d 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 9c658349190c5181992b7fa427f6f5a02b2b9995..a3174ed8621dc50b0b6950b66eb53ddb964bad1d 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 fd3197b4324d534d35b687584f839f83cc99082e..eb4ecf407207a52ddc5dec57590b0062d9eba0ec 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 50396605859e9d05a4a594f824c0093bce057bea..104d32fcb54a1d3d184ebaa053904dbfffb9e8f7 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 0abe14903b4ffbda995eaa3d783c1fe8e8f9b060..3baf12ddbefe20d04f5f0b25d372b217a70ab35b 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 412eb8054a4baf51461059ba010f56e384c840ab..fdd23f2a232c1c652b128173f7be4f5163f67648 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 287d5f2e74c974c33fda3a290ab23458a5e6451c..e5ad0e3b10b3e04d7c52325118dec0e3d10c919c 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 bbc831bfa99783eb1a1b9f7ab0a8e5d2c04cc904..f4d400d5f9692db43fdb45bc9152ffb0cae2b16a 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 248fcb43e92de330435e351caefe1535b34be35f..1448cc63809246d6a6f9b60c23c92214e5436600 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 bfca94999d5deef6665950fcfb4a78d6b1db28ed..98f95d91c51ed5fdcfd3c6886a934b6bb65e6017 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 8e1aec6197321a303041ca440844ba24046b06c0..db0500ae60a96a5b9a40d1eea59f4d03a3ad1026 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 6d57c6b7095ef29940aae9a751ae7fb092eaf1da..8466f312f928e63364ec53aef7a802d7aaad5951 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 2e02b86646e8c08ce7d1b5628166fd61ae2c85a1..d6454dd97fa2a5a9be48e359e23f830453e562a9 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 c0c0bf8fc598af7500482dcb3023681a556d4e33..e0c408bb07cf6a667f60f2442168e52b41577fc8 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 b677e9e8f04d309e2c1644f115c88f2c84f84902..022b4d101b55cfd1e88e3825223e4eedf6ee03d3 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 a2aff794533c4c81eed61e23e58e45c4b97ec27f..573401da589c9f93e3bd4f2b8481694c474c0d00 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 17355b81fce860db0699f5899fb289f6b03935e5..26b5faa8ee59c773595d5a302c195dd1e4905de8 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 10814d1f326c1b66b7f90cadc02a73cca99537a4..2163379bb93477cf33011e9ec54f05484a1710b0 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 badbc676327941df19c9222ecea11c4f8dc7277d..b0b6a0069756c95bf5a2bf5b02f8d6c94f841768 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 90633cd4efe11c285c215f14e457b65cf5b4bc6a..9bad64fda92f6746ddc548b0a48713756ec21948 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 ff4b4fe830cbddc65765a215a6ccabf42312e8f8..e7e4328037f68a1d0836bdc757dc03a18fec22ba 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 c735cd3a26f78296a8b8f0fd595c8c385781a742..01c20d23dba7a76043a0d67cc0bc98f16b45b4f8 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 6166e288f1615790264ac600c181a8c9b1bfc9b0..966b9f21baefddb72d96287538c875df04e94319 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 12c0da7d6b9afed91b77dd25f246b704a6806273..6c41f4ed74201a3d86e0bfe8a0566c0970645c3a 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 6493e5d75078b178bd9f20fc3b5162135b6d6be5..6e901d9a1c4ef03ff79d49e4a5f6f66c9ef92d1c 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 09512ba38eb3a3f85dd128ed4793b9d215eafa96..e52ad78a1e9f242fd7089b43e54df4f841c47aa6 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 e51e2e76989b6317c48160e5dfc264cd977697b0..31d8fe23e2bc708ec44ba911a13342a476b2a642 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 ea4991855fcfe14cb594f62e1370b62de19b2eff..77eb164965fab9005ca69fc4460aaa603f118f94 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 07db4511b4132b8b7a25a828182883bd8f2b7ecc..ba361d23204cb78a18f840a9b3ee560356a97aa2 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 2b7b0a196ce4e774965d94bc3be5fa5992c12bd3..c6b875d6afb312e99c17d3964daeb20c65a06f47 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 6990101b5d55aeaa2526052872502da6856627bb..0000000000000000000000000000000000000000 --- 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 df74d14c90630918d064e8484a2d681d9efb485e..0000000000000000000000000000000000000000 --- 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 c0b9ed9b2cec01197f277406b57df33100eeb785..0000000000000000000000000000000000000000 --- 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