diff --git a/CMakePresets.json b/CMakePresets.json
index 29dd152ed01..5d8af5429fc 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -214,6 +214,14 @@
"PLUGIN_MODELORDERREDUCTION": {
"type": "BOOL",
"value": "ON"
+ },
+ "SOFA_FETCH_SOFAIMPLICITFIELD": {
+ "type": "BOOL",
+ "value": "ON"
+ },
+ "PLUGIN_SOFAIMPLICITFIELD": {
+ "type": "BOOL",
+ "value": "ON"
}
}
},
@@ -256,10 +264,6 @@
"type": "BOOL",
"value": "ON"
},
- "PLUGIN_SOFAIMPLICITFIELD": {
- "type": "BOOL",
- "value": "ON"
- },
"SOFA_FETCH_SOFASPHFLUID": {
"type": "BOOL",
"value": "ON"
diff --git a/applications/plugins/CMakeLists.txt b/applications/plugins/CMakeLists.txt
index 736fbf72423..fcab7fe3da7 100644
--- a/applications/plugins/CMakeLists.txt
+++ b/applications/plugins/CMakeLists.txt
@@ -73,4 +73,4 @@ else()
endif()
sofa_add_subdirectory(plugin SofaDistanceGrid SofaDistanceGrid) # Also defines SofaDistanceGrid.CUDA
-sofa_add_subdirectory(plugin SofaImplicitField SofaImplicitField)
+sofa_add_external(plugin SofaImplicitField GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/SofaImplicitField.git)
diff --git a/applications/plugins/SofaImplicitField/CMakeLists.txt b/applications/plugins/SofaImplicitField/CMakeLists.txt
deleted file mode 100644
index aca4a06b47b..00000000000
--- a/applications/plugins/SofaImplicitField/CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-cmake_minimum_required(VERSION 3.22)
-project(SofaImplicitField VERSION 1.0)
-
-sofa_find_package(Sofa.Component.Topology.Container.Constant REQUIRED)
-
-set(HEADER_FILES
- config.h.in
- initSofaImplicitField.h
- MarchingCube.h
-
- # This is backward compatibility
- deprecated/SphereSurface.h
- deprecated/ImplicitSurfaceContainer.h # This is a backward compatibility file toward ScalarField
- deprecated/InterpolatedImplicitSurface.h # This is a backward compatibility file toward DiscreteGridField
-
- components/engine/FieldToSurfaceMesh.h
- components/geometry/BottleField.h
- components/geometry/DiscreteGridField.h
- components/geometry/SphericalField.h
- components/geometry/ScalarField.h
- components/geometry/StarShapedField.h
- components/mapping/ImplicitSurfaceMapping.h
- components/mapping/ImplicitSurfaceMapping.inl
-)
-
-set(SOURCE_FILES
- initSofaImplicitField.cpp
- MarchingCube.cpp
-
- ## This is a backward compatibility..
- deprecated/SphereSurface.cpp
- deprecated/InterpolatedImplicitSurface.cpp
-
- components/engine/FieldToSurfaceMesh.cpp
- components/geometry/BottleField.cpp
- components/geometry/ScalarField.cpp
- components/geometry/DiscreteGridField.cpp
- components/geometry/SphericalField.cpp
- components/geometry/StarShapedField.cpp
- components/mapping/ImplicitSurfaceMapping.cpp
-)
-
-set(EXTRA_FILES
- README.md
- )
-
-if(SOFA_BUILD_TESTS)
- add_subdirectory(SofaImplicitField_test)
-endif()
-
-add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${EXTRA_FILES})
-target_link_libraries(${PROJECT_NAME} PRIVATE Sofa.Component.Topology.Container.Constant)
-
-find_package(SofaPython3 REQUIRED)
-if (SofaPython3_FOUND)
- add_subdirectory(python)
-endif()
-
-## Install rules for the library and headers; CMake package configurations files
-sofa_create_package_with_targets(
- PACKAGE_NAME ${PROJECT_NAME}
- PACKAGE_VERSION ${PROJECT_VERSION}
- TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES
- RELOCATABLE "plugins"
- )
diff --git a/applications/plugins/SofaImplicitField/MarchingCube.cpp b/applications/plugins/SofaImplicitField/MarchingCube.cpp
deleted file mode 100644
index 4a7d0098b20..00000000000
--- a/applications/plugins/SofaImplicitField/MarchingCube.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture, development version *
-* (c) 2006-2025 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-namespace sofaimplicitfield
-{
-
-void MarchingCube::generateSurfaceMesh(const double isoval, const double mstep, const double invStep,
- const Vec3d& gridmin, const Vec3d& gridmax,
- std::function&, std::vector&)> getFieldValueAt,
- SeqCoord& tmpPoints, SeqTriangles& tmpTriangles)
-{
- int nx = floor((gridmax.x() - gridmin.x()) * invStep) + 1 ;
- int ny = floor((gridmax.y() - gridmin.y()) * invStep) + 1 ;
- int nz = floor((gridmax.z() - gridmin.z()) * invStep) + 1 ;
-
- // Marching cubes only works for a grid size larger than two
- if( nz < 2 || ny < 2 || nx < 2 )
- return;
-
- double cx,cy,cz;
- int z,mk;
- const int *tri;
-
- // Creates two planes
- CubeData c{{-1,-1,-1},0};
- planes.resize(2*nx*ny);
- for(size_t i=0;i &positions, std::vector& output,
- double mstep, double gridmin_y, double gridmin_x, int ny, int nx, float cz,
- std::vector::iterator itDestPlane)
- {
- for (int i=0, y = 0 ; y < ny ; ++y)
- {
- double cy = gridmin_y + mstep * y ;
- for (int x = 0 ; x < nx ; ++x)
- {
- double cx = gridmin_x + mstep * x ;
- positions[i++].set(cx, cy, cz );
- }
- }
- getFieldValueAt(positions, output) ;
-
- for(auto res : output){
- itDestPlane->data = res;
- itDestPlane++;
- }
- };
-
- std::vector positions;
- std::vector output;
- positions.resize(nx*ny);
- output.resize(nx*ny);
-
- fillPlane(positions, output, mstep, gridmin.y(), gridmin.x(), ny, nx, gridmin.z(), P0);
- for (z=1; z<=nz; ++z)
- {
- fillPlane(positions, output, mstep, gridmin.y(), gridmin.x(), ny, nx, gridmin.z() + mstep * z, P1);
-
- int edgecube[12];
- const int edgepts[12] = {0,1,0,1,0,1,0,1,2,2,2,2};
- typename std::vector::iterator base = planes.begin();
- int ip0 = P0-base;
- int ip1 = P1-base;
- edgecube[0] = (ip0 -dy);
- edgecube[1] = (ip0 );
- edgecube[2] = (ip0 );
- edgecube[3] = (ip0-dx );
- edgecube[4] = (ip1 -dy);
- edgecube[5] = (ip1 );
- edgecube[6] = (ip1 );
- edgecube[7] = (ip1-dx );
- edgecube[8] = (ip1-dx-dy);
- edgecube[9] = (ip1-dy );
- edgecube[10] = (ip1 );
- edgecube[11] = (ip1-dx );
-
- unsigned int di = nx;
- for(int y=1; ydata>isoval)^((P1+di-dx)->data>isoval))
- {
- (P1+di)->p[0] = addPoint(tmpPoints, 0, pos,gridmin, (P1+di)->data,(P1+di-dx)->data, mstep, isoval);
- }
- if (((P1+di)->data>isoval)^((P1+di-dy)->data>isoval))
- {
- (P1+di)->p[1] = addPoint(tmpPoints, 1, pos,gridmin,(P1+di)->data,(P1+di-dy)->data, mstep, isoval);
- }
- if (((P1+di)->data>isoval)^((P0+di)->data>isoval))
- {
- (P1+di)->p[2] = addPoint(tmpPoints, 2, pos,gridmin,(P1+di)->data,(P0+di)->data, mstep, isoval);
- }
-
- // All points should now be created
- if ((P0+di-dx-dy)->data > isoval) mk = 1;
- else mk=0;
- if ((P0+di -dy)->data > isoval) mk|= 2;
- if ((P0+di )->data > isoval) mk|= 4;
- if ((P0+di-dx )->data > isoval) mk|= 8;
- if ((P1+di-dx-dy)->data > isoval) mk|= 16;
- if ((P1+di -dy)->data > isoval) mk|= 32;
- if ((P1+di )->data > isoval) mk|= 64;
- if ((P1+di-dx )->data > isoval) mk|= 128;
-
- tri=sofa::helper::MarchingCubeTriTable[mk];
- while (*tri>=0)
- {
- typename std::vector::iterator b = base+di;
- addFace(tmpTriangles,
- (b+edgecube[tri[0]])->p[edgepts[tri[0]]],
- (b+edgecube[tri[1]])->p[edgepts[tri[1]]],
- (b+edgecube[tri[2]])->p[edgepts[tri[2]]], tmpPoints.size());
- tri+=3;
- }
- ++di;
- }
- }
- std::swap(P0, P1);
- }
-}
-
-}
diff --git a/applications/plugins/SofaImplicitField/MarchingCube.h b/applications/plugins/SofaImplicitField/MarchingCube.h
deleted file mode 100644
index 394a6163b1c..00000000000
--- a/applications/plugins/SofaImplicitField/MarchingCube.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture, development version *
-* (c) 2006-2025 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#pragma once
-#include
-
-#include
-#include
-#include
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-namespace sofaimplicitfield
-{
-
-typedef sofa::core::topology::BaseMeshTopology::SeqTriangles SeqTriangles;
-typedef sofa::core::topology::BaseMeshTopology::Triangle Triangle;
-typedef sofa::type::vector SeqCoord;
-using sofa::type::Vec3d;
-
-class MarchingCube
-{
-public:
- void generateSurfaceMesh(const double isoval, const double mstep, const double invStep,
- const Vec3d& gridmin, const Vec3d& gridmax,
- std::function &, std::vector &)> field,
- SeqCoord& tmpPoints, SeqTriangles& tmpTriangles);
-
-private:
- /// For each cube, store the vertex indices on each 3 first edges, and the data value
- struct CubeData
- {
- int p[3];
- double data;
- };
-
- sofa::type::vector planes;
- typename sofa::type::vector::iterator P0; /// Pointer to first plane
- typename sofa::type::vector::iterator P1; /// Pointer to second plane
-
- int addPoint(SeqCoord& v, int i, Vec3d pos, const Vec3d& gridmin, double v0, double v1, double step, double iso)
- {
- pos[i] -= (iso-v0)/(v1-v0);
- v.push_back( (pos * step)+gridmin ) ;
- return v.size()-1;
- }
-
- int addFace(SeqTriangles& triangles, int p1, int p2, int p3, int nbp)
- {
- if ((unsigned)p1<(unsigned)nbp &&
- (unsigned)p2<(unsigned)nbp &&
- (unsigned)p3<(unsigned)nbp)
- {
- triangles.push_back(Triangle(p1, p3, p2));
- return triangles.size()-1;
- }
- else
- {
- return -1;
- }
- }
-};
-
-
-}
-
diff --git a/applications/plugins/SofaImplicitField/README.md b/applications/plugins/SofaImplicitField/README.md
deleted file mode 100644
index 73b1bda083b..00000000000
--- a/applications/plugins/SofaImplicitField/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-= ImplicitField plugin.
-
-
-
diff --git a/applications/plugins/SofaImplicitField/SofaImplicitFieldConfig.cmake.in b/applications/plugins/SofaImplicitField/SofaImplicitFieldConfig.cmake.in
deleted file mode 100644
index f7535c7e032..00000000000
--- a/applications/plugins/SofaImplicitField/SofaImplicitFieldConfig.cmake.in
+++ /dev/null
@@ -1,21 +0,0 @@
-# CMake package configuration file for the SofaImplicitField plugin
-
-@PACKAGE_GUARD@
-@PACKAGE_INIT@
-
-set(SOFAIMPLICITFIELD_HAVE_SOFADISTANCEGRID @SOFAIMPLICITFIELD_HAVE_SOFADISTANCEGRID@)
-
-find_package(Sofa.Framework QUIET REQUIRED)
-
-if(SOFAIMPLICITFIELD_HAVE_SOFADISTANCEGRID)
- find_package(SofaDistanceGrid QUIET REQUIRED)
-endif()
-
-if(NOT TARGET SofaImplicitField)
- include("${CMAKE_CURRENT_LIST_DIR}/SofaImplicitFieldTargets.cmake")
-endif()
-
-check_required_components(SofaImplicitField)
-set(SofaImplicitField_LIBRARIES SofaImplicitField)
-set(SofaImplicitField_INCLUDE_DIRS @PACKAGE_SOFAIMPLICITFIELD_INCLUDE_DIR@ ${SOFAIMPLICITFIELD_INCLUDE_DIR})
-
diff --git a/applications/plugins/SofaImplicitField/SofaImplicitField_test/CMakeLists.txt b/applications/plugins/SofaImplicitField/SofaImplicitField_test/CMakeLists.txt
deleted file mode 100644
index b4042f0c308..00000000000
--- a/applications/plugins/SofaImplicitField/SofaImplicitField_test/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-cmake_minimum_required(VERSION 3.22)
-
-project(SofaImplicitField_test)
-
-set(SOURCE_FILES
- ImplicitShape_test.cpp
-)
-
-
-
-add_executable(${PROJECT_NAME} ${SOURCE_FILES})
-target_link_libraries(${PROJECT_NAME} Sofa.Testing SofaImplicitField)
-
-add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
diff --git a/applications/plugins/SofaImplicitField/SofaImplicitField_test/ImplicitShape_test.cpp b/applications/plugins/SofaImplicitField/SofaImplicitField_test/ImplicitShape_test.cpp
deleted file mode 100644
index f48bc8cccfb..00000000000
--- a/applications/plugins/SofaImplicitField/SofaImplicitField_test/ImplicitShape_test.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the Free *
-* Software Foundation; either version 2 of the License, or (at your option) *
-* any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-
-#include
-
-#include
-using sofa::type::Vec3d ;
-
-#include
-using sofa::component::geometry::SphericalField ;
-
-namespace
-{
-
-class SphericalFieldTest : public sofa::testing::BaseTest
-{
-public:
- bool checkSphericalField();
- bool checkDiscreteGridField();
-};
-
-
-bool SphericalFieldTest::checkSphericalField()
-{
- SphericalField sphere_test;
- Vec3d p(1,1,2);
- sphere_test.getValue(p) ;
- return true;
-}
-
-
-TEST_F(SphericalFieldTest, checkSphericalField) { ASSERT_TRUE( checkSphericalField() ); }
-
-}
diff --git a/applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.cpp b/applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.cpp
deleted file mode 100644
index e42e18467a9..00000000000
--- a/applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture, development version *
-* (c) 2006-2025 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#include
-
-#include
-using sofa::core::visual::VisualParams ;
-
-#include
-using sofa::core::RegisterObject ;
-
-#include
-
-#include "FieldToSurfaceMesh.h"
-
-namespace sofaimplicitfield::component::engine
-{
-
-FieldToSurfaceMesh::FieldToSurfaceMesh()
- : l_field(initLink("field", "The scalar field to generate a mesh from."))
- , d_step(initData(&d_step,0.1,"step","Step"))
- , d_IsoValue(initData(&d_IsoValue,0.0,"isoValue","Iso Value"))
- , d_gridMin(initData(&d_gridMin, Vec3d(-1,-1,-1),"min","Grid Min"))
- , d_gridMax(initData(&d_gridMax, Vec3d(1,1,1),"max","Grid Max"))
- , d_outPoints(initData(&d_outPoints, "points", "position of the tiangles vertex"))
- , d_outTriangles(initData(&d_outTriangles, "triangles", "list of triangles"))
- , d_debugDraw(initData(&d_debugDraw,false, "debugDraw","Display the extracted surface"))
-{
- addUpdateCallback("updateMesh", {&d_step, &d_IsoValue, &d_gridMin, &d_gridMax}, [this](const sofa::core::DataTracker&)
- {
- checkInputs();
- updateMeshIfNeeded();
- return core::objectmodel::ComponentState::Valid;
- }, {&d_outPoints, &d_outTriangles});
- d_outPoints.setGroup("Output");
- d_outTriangles.setGroup("Output");
-}
-
-FieldToSurfaceMesh::~FieldToSurfaceMesh()
-{
-}
-
-void FieldToSurfaceMesh::init()
-{
- if(!l_field.get())
- {
- msg_error() << "Missing field to extract surface from";
- d_componentState = core::objectmodel::ComponentState::Invalid;
- }
-
- d_componentState = core::objectmodel::ComponentState::Valid;
-}
-
-void FieldToSurfaceMesh::computeBBox(const core::ExecParams* /* params */, bool /*onlyVisible*/)
-{
- f_bbox.setValue({d_gridMin.getValue(), d_gridMax.getValue()});
-}
-
-void FieldToSurfaceMesh::checkInputs(){
-
- auto length = d_gridMax.getValue()-d_gridMin.getValue() ;
- auto step = d_step.getValue();
-
- // clamp the mStep value to avoid too large grids
- if( step < 0.0001 || (length.x() / step > 256) || length.y() / step > 256 || length.z() / step > 256)
- {
- d_step.setValue( *std::max_element(length.begin(), length.end()) / 256.0 );
- msg_warning() << "step exceeding grid size, clamped to " << d_step.getValue();
- }
-}
-
-void FieldToSurfaceMesh::updateMeshIfNeeded()
-{
- sofa::helper::getWriteOnlyAccessor(d_outPoints).clear();
- sofa::helper::getWriteOnlyAccessor(d_outTriangles).clear();
-
- double isoval = d_IsoValue.getValue();
- double mstep = d_step.getValue();
- double invStep = 1.0/d_step.getValue();
-
- Vec3d gridmin = d_gridMin.getValue() ;
- Vec3d gridmax = d_gridMax.getValue() ;
-
- auto field = l_field.get();
-
- if(!field)
- return;
-
- // Clear the previously used buffer
- tmpPoints.clear();
- tmpTriangles.clear();
-
- marchingCube.generateSurfaceMesh(isoval, mstep, invStep, gridmin, gridmax,
- [field](std::vector& positions, std::vector& res){
- int i=0;
- for(auto& position : positions)
- {
- res[i++]=field->getValue(position);
- }
- },
- tmpPoints, tmpTriangles);
-
- /// Copy the surface to Sofa topology
- d_outPoints.setValue(tmpPoints);
- d_outTriangles.setValue(tmpTriangles);
-
- tmpPoints.clear();
- tmpTriangles.clear();
-
- hasChanged = false;
- return;
-}
-
-void FieldToSurfaceMesh::draw(const VisualParams* vparams)
-{
- if(isComponentStateInvalid())
- return;
-
- if(!d_debugDraw.getValue())
- return;
-
- auto drawTool = vparams->drawTool();
-
- sofa::helper::ReadAccessor< Data > x = d_outPoints;
- sofa::helper::ReadAccessor< Data > triangles = d_outTriangles;
- drawTool->setLightingEnabled(true);
-
- for(const Triangle& triangle : triangles)
- {
- int a = triangle[0];
- int b = triangle[1];
- int c = triangle[2];
- Vec3d center = (x[a]+x[b]+x[c])*0.333333;
- Vec3d pa = (0.9*x[a]+0.1*center) ;
- Vec3d pb = (0.9*x[b]+0.1*center) ;
- Vec3d pc = (0.9*x[c]+0.1*center) ;
-
- vparams->drawTool()->drawTriangles({pb,pa,pc},
- type::RGBAColor(0.0,0.0,1.0,1.0));
- }
-
- if(x.size()>1000){
- drawTool->drawPoints(x, 1.0, type::RGBAColor(1.0,1.0,0.0,0.2)) ;
- }else{
- drawTool->drawSpheres(x, 0.01, type::RGBAColor(1.0,1.0,0.0,0.2)) ;
- }
-}
-
-// Register in the Factory
-void registerFieldToSurfaceMesh(sofa::core::ObjectFactory* factory)
-{
- factory->registerObjects(sofa::core::ObjectRegistrationData("Generates a surface mesh from a field function.")
- .add< FieldToSurfaceMesh >());
-}
-
-}
diff --git a/applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.h b/applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.h
deleted file mode 100644
index e92783b020e..00000000000
--- a/applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture, development version *
-* (c) 2006-2025 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#pragma once
-#include
-#include
-#include
-#include
-#include
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-namespace sofaimplicitfield::component::engine
-{
-using namespace sofa;
-
-typedef sofa::core::topology::BaseMeshTopology::SeqTriangles SeqTriangles;
-typedef sofa::core::topology::BaseMeshTopology::Triangle Triangle;
-typedef sofa::type::vector VecCoord;
-
-using sofa::component::geometry::ScalarField;
-using sofa::core::visual::VisualParams ;
-using BaseObject [[deprecated("Use sofa::core::objectmodel::BaseObject instead.")]] = sofa::core::objectmodel::BaseObject;
-using sofa::type::Vec3d ;
-
-class FieldToSurfaceMesh : public BaseObject
-{
-public:
- SOFA_CLASS(FieldToSurfaceMesh, BaseObject);
-
- virtual void init() override ;
- virtual void draw(const VisualParams*params) override ;
-
- double getStep() const { return d_step.getValue(); }
- void setStep(double val) { d_step.setValue(val); }
-
- double getIsoValue() const { return d_IsoValue.getValue(); }
- void setIsoValue(double val) { d_IsoValue.setValue(val); }
-
- const Vec3d& getGridMin() const { return d_gridMin.getValue(); }
- void setGridMin(const Vec3d& val) { d_gridMin.setValue(val); }
- void setGridMin(double x, double y, double z) { d_gridMin.setValue( Vec3d(x,y,z)); }
-
- const Vec3d& getGridMax() const { return d_gridMax.getValue(); }
- void setGridMax(const Vec3d& val) { d_gridMax.setValue(val); }
- void setGridMax(double x, double y, double z) { d_gridMax.setValue( Vec3d(x,y,z)); }
-
-protected:
- SingleLink l_field ;
-
- Data d_step;
- Data d_IsoValue;
-
- Data< Vec3d > d_gridMin;
- Data< Vec3d > d_gridMax;
-
- /// Output
- Data d_outPoints;
- Data d_outTriangles;
- Data d_debugDraw;
-
-protected:
- FieldToSurfaceMesh() ;
- virtual ~FieldToSurfaceMesh() ;
-
-private:
- void computeBBox(const core::ExecParams* /* params */, bool /*onlyVisible*/=false) override;
-
- void checkInputs();
-
- void generateSurfaceMesh(double isoval, double mstep, double invStep,
- Vec3d gridmin, Vec3d gridmax,
- sofa::component::geometry::ScalarField*);
- void updateMeshIfNeeded();
-
- bool hasChanged {true} ;
- VecCoord tmpPoints;
- SeqTriangles tmpTriangles;
-
- MarchingCube marchingCube;
-};
-
-}
-
diff --git a/applications/plugins/SofaImplicitField/components/geometry/BottleField.cpp b/applications/plugins/SofaImplicitField/components/geometry/BottleField.cpp
deleted file mode 100644
index 2ed50eb2837..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/BottleField.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#include
-#include
-using sofa::core::RegisterObject ;
-
-#include "BottleField.h"
-
-namespace sofa::component::geometry::_BottleField_
-{
-
-using sofa::type::Vec2;
-
-BottleField::BottleField()
- : d_inside(initData(&d_inside, false, "inside", "If true the field is oriented inside (resp. outside) the bottle-shaped object. (default = false)"))
- , d_radiusSphere(initData(&d_radiusSphere, 1.0, "radius", "Radius of Sphere emitting the field. (default = 1)"))
- , d_centerSphere(initData(&d_centerSphere, Vec3d(0.0,0.0,0.0), "center", "Position of the Sphere Surface. (default=0 0 0)" ))
- , d_shift(initData(&d_shift, 1.0, "shift", "How much the top ellipsoid is shifted from the bottom sphere. (default=1)" ))
- , d_ellipsoidRadius(initData(&d_ellipsoidRadius, 1.0, "ellipsoidRadius", "Radius of the ellipsoid whose intersection with the sphere is taken off" ))
- , d_excentricity(initData(&d_excentricity, 1.0, "excentricity", "excentricity of ellipsoid" ))
-{
- init();
- addUpdateCallback("myUpdateCallback", {&d_inside, &d_radiusSphere, &d_centerSphere, &d_shift, &d_ellipsoidRadius, &d_excentricity}, [this](const core::DataTracker& t)
- {
- SOFA_UNUSED(t);
- this->init();
- return sofa::core::objectmodel::ComponentState::Valid;
- }, {});
-}
-
-void BottleField::init()
-{
- m_inside = d_inside.getValue();
- m_center = d_centerSphere.getValue();
- m_radius = d_radiusSphere.getValue();
- m_shift = d_shift.getValue();
- m_ellipsoidRadius = d_ellipsoidRadius.getValue();
- m_excentricity = d_excentricity.getValue();
-}
-
-void BottleField::reinit()
-{
- init();
-}
-
-double BottleField::outerLength(Vec3d& Pos)
-{
- return sqrt((Pos[0] - m_center[0])*(Pos[0] - m_center[0]) +
- (Pos[1] - m_center[1])*(Pos[1] - m_center[1]) +
- (Pos[2] - m_center[2])*(Pos[2] - m_center[2]));
-}
-
-double BottleField::innerLength(Vec3d& Pos)
-{
- return sqrt(m_excentricity*(Pos[0] - m_center[0])*(Pos[0] - m_center[0]) +
- (Pos[1] - (m_center[1]+m_shift))*(Pos[1] - (m_center[1]+m_shift)) +
- m_excentricity*(Pos[2] - m_center[2])*(Pos[2] - m_center[2]));
-}
-
-double BottleField::getValue(Vec3d& Pos, int& domain)
-{
- SOFA_UNUSED(domain) ;
- double resultSphereOuter = this->outerLength(Pos) - m_radius ;
- double resultEllipsoidInner = this->innerLength(Pos) - m_ellipsoidRadius;
-
- double result = std::max(resultSphereOuter,-resultEllipsoidInner);
-
- if(m_inside)
- result = -result;
-
- return result;
-}
-
-Vec3d BottleField::getGradient(Vec3d &Pos, int &domain)
-{
- SOFA_UNUSED(domain);
- Vec3d g;
-
- double LsphereOuter = this->outerLength(Pos) ;
- double LEllipsoidInner = this->innerLength(Pos) ;
-
- if (LsphereOuter - m_radius > - (LEllipsoidInner- m_ellipsoidRadius)){
- g[0] = (Pos[0] - m_center[0])/LsphereOuter;
- g[1] = (Pos[1] - m_center[1])/LsphereOuter;
- g[2] = (Pos[2] - m_center[2])/LsphereOuter;
- }
- else
- {
- g[0] = -m_excentricity*(Pos[0] - m_center[0])/LEllipsoidInner;
- g[1] = -(Pos[1] - (m_center[1]+m_shift))/LEllipsoidInner;
- g[2] = -m_excentricity*(Pos[2] - m_center[2])/LEllipsoidInner;
- }
-
-
- if (m_inside)
- {
- g[0] = -g[0];
- g[1] = -g[1];
- g[2] = -g[2];
- }
-
- return g;
-}
-
-void BottleField::getHessian(Vec3d &Pos, Mat3x3& h)
-{
- double LsphereOuter = this->outerLength(Pos) ;
- double LEllipsoidInner = this->innerLength(Pos) ;
-
- if (LsphereOuter - m_radius > - (LEllipsoidInner- m_ellipsoidRadius))
- {
- double LsphereOuterSquare = LsphereOuter*LsphereOuter;
- double LsphereOuterCube = LsphereOuter*LsphereOuter*LsphereOuter;
- h[0][0] = ( LsphereOuter - (Pos[0] - m_center[0])*(Pos[0] - m_center[0])/LsphereOuter )/LsphereOuterSquare ;
- h[1][1] = ( LsphereOuter - (Pos[1] - m_center[1])*(Pos[1] - m_center[1])/LsphereOuter )/LsphereOuterSquare ;
- h[2][2] = ( LsphereOuter - (Pos[2] - m_center[2])*(Pos[2] - m_center[2])/LsphereOuter )/LsphereOuterSquare ;
-
- h[0][1] = h[1][0] = - (Pos[0] - m_center[0])*(Pos[1] - m_center[1]) / LsphereOuterCube;
- h[0][2] = h[2][0] = - (Pos[0] - m_center[0])*(Pos[2] - m_center[2]) / LsphereOuterCube;
- h[1][2] = h[2][1] = - (Pos[2] - m_center[2])*(Pos[1] - m_center[1]) / LsphereOuterCube;
- }
- else
- {
- double LEllipsoidInnerSquare = LEllipsoidInner*LEllipsoidInner;
- double LEllipsoidInnerCube = LEllipsoidInner*LEllipsoidInner*LEllipsoidInner;
- h[0][0] = -m_excentricity*(LEllipsoidInner - m_excentricity*(Pos[0] - m_center[0])*(Pos[0] - m_center[0])/LEllipsoidInner )/LEllipsoidInnerSquare ;
- h[1][1] = -(LEllipsoidInner - (Pos[1] - (m_center[1]+m_shift))*(Pos[1] - (m_center[1]+m_shift))/LEllipsoidInner )/LEllipsoidInnerSquare ;
- h[2][2] = -m_excentricity*(LEllipsoidInner - m_excentricity*(Pos[2] - m_center[2])*(Pos[2] - m_center[2])/LEllipsoidInner )/LEllipsoidInnerSquare ;
-
- h[0][1] = h[1][0] = m_excentricity*(Pos[0] - m_center[0])*(Pos[1] - (m_center[1]+m_shift)) / LEllipsoidInnerCube;
- h[0][2] = h[2][0] = m_excentricity*m_excentricity*(Pos[0] - m_center[0])*(Pos[2] - m_center[2]) / LEllipsoidInnerCube;
- h[1][2] = h[2][1] = m_excentricity*(Pos[2] - m_center[2])*(Pos[1] - (m_center[1]+m_shift)) / LEllipsoidInnerCube;
- }
-
- if (m_inside)
- {
- for (unsigned int i=0; i<3; i++)
- for (unsigned int j=0; j<3; j++)
- h[i][j] = -h[i][j];
- }
-
- return;
-}
-
-// Register in the Factory
-void registerBottleField(sofa::core::ObjectFactory* factory)
-{
- factory->registerObjects(sofa::core::ObjectRegistrationData("A bottle implicit field.")
- .add< BottleField >());
-}
-
-} // namespace sofa::component::geometry::_BottleField_
diff --git a/applications/plugins/SofaImplicitField/components/geometry/BottleField.h b/applications/plugins/SofaImplicitField/components/geometry/BottleField.h
deleted file mode 100644
index 1f62df0c172..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/BottleField.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#pragma once
-
-#include "ScalarField.h"
-#include
-namespace sofa::component::geometry
-{
-
-namespace _BottleField_
-{
-
-using sofa::type::Vec3d;
-using sofa::type::Mat3x3;
-
-/**
- * This component emulates an implicit field shaped by a sphere with a hole made by an ellispsoid. The result may look like some kind of bottle or vase.
-*/
-
-class SOFA_SOFAIMPLICITFIELD_API BottleField : public ScalarField
-{
-public:
- SOFA_CLASS(BottleField, ScalarField);
-
-public:
- BottleField() ;
- ~BottleField() override { }
-
- /// Inherited from BaseObject
- void init() override ;
- void reinit() override ;
-
- /// Inherited from ScalarField.
- double getValue(Vec3d& Pos, int &domain) override ;
- Vec3d getGradient(Vec3d &Pos, int& domain) override ;
- void getHessian(Vec3d &Pos, Mat3x3& h) override;
-
- double outerLength(Vec3d& Pos);
- double innerLength(Vec3d& Pos);
-
- using ScalarField::getValue ;
- using ScalarField::getGradient ;
- using ScalarField::getValueAndGradient ;
-
- Data d_inside; ///< If true the field is oriented inside (resp. outside) the bottle-shaped object. (default = false)
- Data d_radiusSphere; ///< Radius of Sphere emitting the field. (default = 1)
- Data d_centerSphere; ///< Position of the Sphere Surface. (default=0 0 0)
- Data d_shift; ///< How much the top ellipsoid is shifted from the bottom sphere. (default=1)
- Data d_ellipsoidRadius; ///< Radius of the ellipsoid whose intersection with the sphere is taken off
- Data d_excentricity; ///< excentricity of ellipsoid
-protected:
- Vec3d m_center;
- double m_radius;
- bool m_inside;
- double m_shift;
- double m_ellipsoidRadius;
- double m_excentricity;
-};
-
-} //namespace _BottleField_
-
-using sofa::component::geometry::_BottleField_::BottleField;
-
-} //namespace sofa::component::geometry
-
diff --git a/applications/plugins/SofaImplicitField/components/geometry/DiscreteGridField.cpp b/applications/plugins/SofaImplicitField/components/geometry/DiscreteGridField.cpp
deleted file mode 100644
index fa6949c0928..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/DiscreteGridField.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#include
-#include
-#include
-using sofa::core::RegisterObject ;
-
-#include "DiscreteGridField.h"
-
-
-namespace sofa::component::geometry::_discretegrid_
-{
-
-/**
-DiscreteGridField::DiscreteGridField()
- : in_filename(initData(&in_filename,"filename","filename"))
- , in_nx(initData(&in_nx,0,"nx","in_nx"))
- , in_ny(initData(&in_ny,0,"ny","in_ny"))
- , in_nz(initData(&in_nz,0,"nz","in_nz"))
- , in_scale(initData(&in_scale,0.0,"scale","in_scale"))
- , in_sampling(initData(&in_sampling,0.0,"sampling","in_sampling"))
-{
-}
-
-
-
-void DiscreteGridField::init()
-{
- if(in_nx.getValue()==0 && in_nz.getValue()==0 && in_nz.getValue()==0) {
- d_componentState.setValue(ComponentState::Invalid);
- msg_error() << "uninitialized grid";
- }
- else if(in_filename.isSet() == false) {
- d_componentState.setValue(ComponentState::Invalid)
- msg_error() << "unset filename";
- }
- else {
- pmin.set(0,0,-5.0);
- pmax.set(27,27,5.0);
- loadGrid(in_scale.getValue(),in_sampling.getValue(),in_nx.getValue(),in_ny.getValue(),in_nz.getValue(),pmin,pmax);
- }
-
- d_componentState.setValue(ComponentState::Valid)
-}
-*/
-
-DiscreteGridField::DiscreteGridField()
- : ScalarField(),
- d_distanceMapHeader( initData( &d_distanceMapHeader, "file", "MHD file for the distance map" ) ),
- d_maxDomains( initData( &d_maxDomains, 1, "maxDomains", "Number of domains available for caching" ) ),
- dx( initData( &dx, 0.0, "dx", "x translation" ) ),
- dy( initData( &dy, 0.0, "dy", "y translation" ) ),
- dz( initData( &dz, 0.0, "dz", "z translation" ) )
-{
- m_usedDomains = 0;
- m_imgData = nullptr;
-}
-
-
-DiscreteGridField::~DiscreteGridField()
-{
- if (m_imgData)
- {
- delete[] m_imgData;
- m_imgData = nullptr;
- }
-}
-
-
-///used to set a name in tests
-void DiscreteGridField::setFilename(const std::string& name)
-{
- d_distanceMapHeader.setValue(name);
-}
-
-
-void DiscreteGridField::init()
-{
- m_domainCache.resize( d_maxDomains.getValue() );
- bool ok = loadGridFromMHD( d_distanceMapHeader.getFullPath().c_str() );
- if (ok) printf( "Successfully loaded distance map.\n" );
-}
-
-
-bool DiscreteGridField::loadGridFromMHD( const char *filename )
-{
- m_imgMin[0]=m_imgMin[1]=m_imgMin[2] = 0;
- m_spacing[0]=m_spacing[1]=m_spacing[2] = 1;
- m_imgSize[0]=m_imgSize[1]=m_imgSize[2] = 0;
-
- char buffer[1024];
- char *value;
- bool dataFileSpecified = false;
- float f0, f1, f2;
- int i0, i1, i2;
- char dataFile[1024];
-
- // read header file
- std::ifstream header( filename );
- if (!header.is_open()) return false;
- while (!header.eof())
- {
- header.getline( buffer, 1024 );
- if (strncmp( buffer, "ObjectType", 10 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- if (strncmp( value, "Image", 5 ) != 0)
- {
- printf( "ERROR: Object is no image.\n" );
- return false;
- }
- }
- else if (strncmp( buffer, "NDims", 5 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- if (*value != '3')
- {
- printf( "ERROR: Wrong number of dimensions.\n" );
- return false;
- }
- }
- else if (strncmp( buffer, "BinaryData ", 11 ) == 0 || strncmp( buffer, "BinaryData=", 11 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- if (strncmp( value, "True", 4 ) != 0)
- {
- printf( "ERROR: Data is not binary.\n" );
- return false;
- }
- }
- else if (strncmp( buffer, "CompressedData", 14 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- if (strncmp( value, "False", 5 ) != 0)
- {
- printf( "ERROR: Data is compressed.\n" );
- return false;
- }
- }
- else if (strncmp( buffer, "TransformMatrix", 15 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- if (strncmp( value, "1 0 0 0 1 0 0 0 1", 17 ) != 0)
- {
- printf( "ERROR: Unsupported transform matrix.\n" );
- return false;
- }
- }
- else if (strncmp( buffer, "Offset", 6 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- sscanf( value, "%f %f %f", &f0, &f1, &f2 );
- m_imgMin[0]=f0; m_imgMin[1]=f1; m_imgMin[2]=f2;
- printf( "Image offset = %f %f %f\n", m_imgMin[0], m_imgMin[1], m_imgMin[2] );
- }
- else if (strncmp( buffer, "ElementSpacing", 14 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- sscanf( value, "%f %f %f", &f0, &f1, &f2 );
- m_spacing[0]=f0; m_spacing[1]=f1; m_spacing[2]=f2;
- printf( "Image spacing = %f %f %f\n", m_spacing[0], m_spacing[1], m_spacing[2] );
- }
- else if (strncmp( buffer, "DimSize", 7 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- sscanf( value, "%d %d %d", &i0, &i1, &i2 );
- m_imgSize[0]=i0; m_imgSize[1]=i1; m_imgSize[2]=i2;
- printf( "Image size = %i %i %i\n", m_imgSize[0], m_imgSize[1], m_imgSize[2] );
- }
- else if (strncmp( buffer, "ElementType", 11 ) == 0)
- {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- if (strncmp( value, "MET_FLOAT", 9) != 0)
- {
- printf( "ERROR: Datatype is not supported.\n" );
- return false;
- }
- }
- /* Don't allow variable names for problems with correct file paths!
- else if (strncmp( buffer, "ElementDataFile", 11 ) == 0) {
- value = strchr( buffer, '=' )+1; while (*value==' ') value++;
- strncpy( dataFile, value, sizeof(dataFile) - 1 );
- dataFile[sizeof(dataFile) - 1] = '\0';
- dataFileSpecified = true;
- }*/
- }
- header.close();
-
- // init remaining variables
- for (int d=0; d<3; d++)
- {
- m_scale[d] = 1.0/m_spacing[d];
- m_imgMax[d] = m_imgMin[d] + (double)(m_imgSize[d]-1)*m_spacing[d];
- }
- m_deltaOfs[0] = 0;
- m_deltaOfs[1] = 1;
- m_deltaOfs[2] = m_imgSize[0];
- m_deltaOfs[3] = m_imgSize[0]+1;
- unsigned int sliceSize = m_imgSize[0]*m_imgSize[1];
- m_deltaOfs[4] = m_deltaOfs[0] + sliceSize;
- m_deltaOfs[5] = m_deltaOfs[1] + sliceSize;
- m_deltaOfs[6] = m_deltaOfs[2] + sliceSize;
- m_deltaOfs[7] = m_deltaOfs[3] + sliceSize;
-
- // read data file
- if (!dataFileSpecified)
- {
- // change extension to .raw
- strncpy( dataFile, filename, sizeof(dataFile) - 1 );
- dataFile[sizeof(dataFile) - 1] = '\0';
- size_t lenWithoutExt = strlen( filename );
- if (lenWithoutExt >= 3)
- lenWithoutExt -= 3;
- if (lenWithoutExt < sizeof(dataFile) - 4)
- {
- dataFile[lenWithoutExt] = '\0';
- strncat( dataFile, "raw", sizeof(dataFile) - lenWithoutExt - 1 );
- }
- else
- {
- printf( "Warning: filename too long to replace extension, keeping '%s'\n", dataFile );
- }
- }
- std::ifstream data( dataFile, std::ios_base::binary|std::ios_base::in );
- if (!data.is_open()) return false;
- unsigned int numVoxels = m_imgSize[0]*m_imgSize[1]*m_imgSize[2];
- m_imgData = new float[numVoxels];
- data.read( (char*)m_imgData, numVoxels*sizeof(float) );
- if (data.bad()) return false;
- data.close();
- return true;
-}
-
-void DiscreteGridField::updateCache( DomainCache *cache, Vec3d& pos )
-{
- cache->insideImg = true;
- for (int d=0; d<3; d++) if (pos[d]=m_imgMax[d])
- {
- cache->insideImg = false;
- break;
- }
- if (cache->insideImg)
- {
- int voxMinPos[3];
- for (int d=0; d<3; d++)
- {
- voxMinPos[d] = (int)(m_scale[d] * (pos[d]-m_imgMin[d]));
- cache->bbMin[d] = m_spacing[d]*(double)voxMinPos[d] + m_imgMin[d];
- cache->bbMax[d] = cache->bbMin[d] + m_spacing[d];
- }
- unsigned int ofs = voxMinPos[0] + m_imgSize[0]*(voxMinPos[1] + m_imgSize[1]*voxMinPos[2]);
- cache->val[0] = m_imgData[ofs];
- for (int i=1; i<8; i++) cache->val[i] = m_imgData[ofs+m_deltaOfs[i]];
- }
- else
- {
- // init bounding box to be as large as possible to prevent unnecessary cache updates while outside image
- const double MIN=-10e6, MAX=10e6;
- int voxMappedPos[3];
- for (int d=0; d<3; d++)
- {
- if (pos[d] < m_imgMin[d])
- {
- cache->bbMin[d] = MIN;
- cache->bbMax[d] = m_imgMin[d];
- voxMappedPos[d] = 0;
- }
- else if (pos[d] >= m_imgMax[d])
- {
- cache->bbMin[d] = m_imgMax[d];
- cache->bbMax[d] = MAX;
- voxMappedPos[d] = m_imgSize[d]-1;
- }
- else
- {
- cache->bbMin[d] = MIN;
- cache->bbMax[d] = MAX;
- voxMappedPos[d] = (int)(m_scale[d] * (pos[d]-m_imgMin[d]));
- }
- }
- unsigned int ofs = voxMappedPos[0] + m_imgSize[0]*(voxMappedPos[1] + m_imgSize[1]*voxMappedPos[2]);
- // if cache lies outside image, the returned distance is not updated anymore, instead this boundary value is returned
- cache->val[0] = m_imgData[ofs] + m_spacing[0]+m_spacing[1]+m_spacing[2];
- }
-}
-
-
-int DiscreteGridField::getNextDomain()
-{
- // while we have free domains always return the next one, afterwards always use the last one
- if (m_usedDomains < (int)m_domainCache.size()) m_usedDomains++;
- return m_usedDomains-1;
-}
-
-
-double DiscreteGridField::getValue( Vec3d &transformedPos, int &domain )
-{
- // use translation
- Vec3d pos;
- pos[0] = transformedPos[0] - dx.getValue();
- pos[1] = transformedPos[1] - dy.getValue();
- pos[2] = transformedPos[2] - dz.getValue();
- // find cache domain and check if it needs an update
- DomainCache *cache;
- if (domain < 0)
- {
- domain = getNextDomain();
- cache = &(m_domainCache[domain]);
- updateCache( cache, pos );
- }
- else
- {
- cache = &(m_domainCache[domain]);
- for (int d=0; d<3; d++)
- {
- if (pos[d]bbMin[d] || pos[d]>cache->bbMax[d])
- {
- updateCache( cache, pos );
- break;
- }
- }
- }
-
- // if cache lies outside image, the returned distance is not updated anymore, instead this boundary value is returned
- if (!cache->insideImg) return cache->val[0];
-
- // use trilinear interpolation on cached cube
- double weight[3];
- for (int d=0; d<3; d++)
- {
- weight[d] = m_scale[d] * (pos[d]-cache->bbMin[d]);
- }
- double d = weight[0]*weight[1];
- double c = weight[1] - d;
- double b = weight[0] - d;
- double a = (1.0-weight[1]) - b;
- double res = ( cache->val[0]*a + cache->val[1]*b + cache->val[2]*c + cache->val[3]*d ) * (1.0-weight[2])
- + ( cache->val[4]*a + cache->val[5]*b + cache->val[6]*c + cache->val[7]*d ) * weight[2];
-
- return res;
-}
-
-
-double DiscreteGridField::getValue( Vec3d &transformedPos )
-{
- static int domain=-1;
- return getValue( transformedPos, domain );
-}
-
-// Register in the Factory
-void registerDiscreteGridField(sofa::core::ObjectFactory* factory)
-{
- factory->registerObjects(sofa::core::ObjectRegistrationData("A discrete scalar field from a regular grid storing field value with interpolation.")
- .add< DiscreteGridField >());
-}
-
-} ///namespace sofa::component::geometry::_discretegrid_
diff --git a/applications/plugins/SofaImplicitField/components/geometry/DiscreteGridField.h b/applications/plugins/SofaImplicitField/components/geometry/DiscreteGridField.h
deleted file mode 100644
index a98e897d4c3..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/DiscreteGridField.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#ifndef SOFAIMPLICITFIELD_COMPONENT_DISCRETEGRIDFIELD_H
-#define SOFAIMPLICITFIELD_COMPONENT_DISCRETEGRIDFIELD_H
-#include
-
-#include
-#include
-
-namespace sofa
-{
-
-namespace component
-{
-
-namespace geometry
-{
-
-namespace _discretegrid_
-{
-
-using sofa::type::Vec3d;
-
-class SOFA_SOFAIMPLICITFIELD_API DomainCache
-{
-public:
- bool insideImg; // shows if the domain lies inside the valid image region or outside
- Vec3d bbMin, bbMax; // bounding box (min and max) of the domain
- double val[8]; // corner values of the domain
-};
-
-class SOFA_SOFAIMPLICITFIELD_API DiscreteGridField : public virtual ScalarField
-{
-
-public:
- SOFA_CLASS(DiscreteGridField, ScalarField);
-
-public:
- DiscreteGridField();
- ~DiscreteGridField() override;
-
- void init() override;
-
- virtual double getValue( Vec3d &transformedPos );
- double getValue( Vec3d &transformedPos, int &domain ) override;
- int getDomain( Vec3d &pos, int ref_domain ) override { (void)pos; return ref_domain; }
-
- void setFilename(const std::string& filename) ;
- bool loadGridFromMHD( const char *filename ) ;
-
- void updateCache( DomainCache *cache, Vec3d& pos );
- int getNextDomain();
-
- sofa::core::objectmodel::DataFileName d_distanceMapHeader;
- Data< int > d_maxDomains; ///< Number of domains available for caching
- Data< double > dx; ///< x translation
- Data< double > dy; ///< y translation
- Data< double > dz; ///< z translation
-
- int m_usedDomains; // number of domains already given out
- unsigned int m_imgSize[3]; // number of voxels
- double m_spacing[3]; // physical distance between two neighboring voxels
- double m_scale[3]; // (1/spacing)
- double m_imgMin[3], m_imgMax[3]; // physical locations of the centers of both corner voxels
- float *m_imgData; // raw data
- unsigned int m_deltaOfs[8]; // offsets to define 8 corners of cube for interpolation
- std::vector m_domainCache;
-};
-
-} /// namespace _discretegrid_
-using _discretegrid_::DiscreteGridField ;
-
-} /// namespace geometry
-
-} /// namespace component
-
-} /// namespace sofa
-
-#endif
-
diff --git a/applications/plugins/SofaImplicitField/components/geometry/ScalarField.cpp b/applications/plugins/SofaImplicitField/components/geometry/ScalarField.cpp
deleted file mode 100644
index 9c0323bbfd8..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/ScalarField.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-/******************************************************************************
-* Contributors:
-* - damien.marchal@univ-lille.fr
-* - olivier.goury@inria.fr
-******************************************************************************/
-
-
-#include
-#include "ScalarField.h"
-namespace sofa
-{
-
-namespace component
-{
-
-namespace geometry
-{
-
-namespace _scalarfield_
-{
-
-void ScalarField::init()
-{
- d_componentState.setValue(core::objectmodel::ComponentState::Valid);
-}
-
-Vec3d ScalarField::getGradientByFinitDifference(Vec3d& pos, int& i)
-{
- Vec3d Result;
- double epsilon = d_epsilon.getValue();
- pos[0] += epsilon;
- Result[0] = getValue(pos, i);
- pos[0] -= epsilon;
- pos[1] += epsilon;
- Result[1] = getValue(pos, i);
- pos[1] -= epsilon;
- pos[2] += epsilon;
- Result[2] = getValue(pos, i);
- pos[2] -= epsilon;
-
- double v = getValue(pos, i);
- Result[0] = (Result[0]-v)/epsilon;
- Result[1] = (Result[1]-v)/epsilon;
- Result[2] = (Result[2]-v)/epsilon;
-
- return Result;
-}
-
-Vec3d ScalarField::getGradient(Vec3d& pos, int& i)
-{
- return getGradientByFinitDifference(pos, i);
-}
-
-void ScalarField::getValueAndGradient(Vec3d& pos, double &value, Vec3d& grad, int& domain)
-{
- value = getValue(pos,domain);
- grad = getGradient(pos,domain);
-}
-
-void ScalarField::getHessianByCentralFiniteDifference(const Vec3d& x, const double dx,
- Mat3x3& hessian)
-{
- /// Centrale Finite difference using only function's value
- /// implemented from https://v8doc.sas.com/sashtml/ormp/chap5/sect28.htm
- /// Second-order derivatives based on function calls only (Abramowitz and Stegun 1972, p. 884):
- Vec3d e[3] = {Vec3d{dx,0.0,0.0},
- Vec3d{0.0,dx,0.0},
- Vec3d{0.0,0.0,dx}};
- double invTerm = 1.0 / (4.0 * dx * dx);
- Vec3d tmpX;
- for(unsigned int i=0;i<3;i++)
- {
- for(unsigned int j=0;j<3;j++)
- {
- tmpX = x + e[i] + e[j] ;
- double p1 = this->getValue(tmpX);
-
- tmpX = x + e[i] - e[j];
- double p2 = -this->getValue(tmpX);
-
- tmpX = x - e[i] + e[j];
- double p3 = - this->getValue(tmpX);
-
- tmpX = x - e[i] - e[j];
- double p4 = +this->getValue(tmpX);
- hessian[i][j] = (p1 + p2 + p3 + p4) * invTerm;
- }
- }
-}
-
-
-void ScalarField::getHessian(Vec3d &Pos, Mat3x3& h)
-{
- getHessianByCentralFiniteDifference(Pos, d_epsilon.getValue(), h);
-}
-
-bool ScalarField::computeSegIntersection(Vec3d& posInside, Vec3d& posOutside, Vec3d& intersecPos, int i)
-{
-
-
- double tolerance = 0.00001; // tolerance sur la précision m
-
- float a = (float)getValue(posInside, i);
- float b = (float)getValue(posOutside, i);
-
- if (a*b>0)
- {
- msg_warning()<<"les deux points sont du même côté de la surface \n";
- return false;
- }
-
- if(b<0)
- {
- msg_warning()<<"posOutside is inside";
- return false;
- }
-
-
-
- Vec3d Seg = posInside-posOutside;
- if (Seg.norm() < tolerance) // TODO : macro on the global precision
- {
- intersecPos = posOutside;
- return true;
- }
-
- // we start on posInside and search for the first point outside with a step given by scale //
- int count=0;
- Vec3d step = Seg;
- double val = b;
- intersecPos = posOutside;
-
- double step_incr=0.1;
-
- while(step.norm()> tolerance && count < 1000)
- {
- step *= step_incr;
-
- while (val >= 0 && count < (1/step_incr + 1))
- {
- count++;
- intersecPos += step;
- val = getValue(intersecPos, i);
- }
-
- // we restart with more precision
- intersecPos -=step;
-
- val = getValue(intersecPos, i);
- if (val < 0)
- msg_warning()<<": val is negative\n" ;
- }
-
- if (count>998)
- {
- msg_error()<<"in computeSegIntersection: Seg : "<0)
- {
- posInside = point;
- while(value>0 && count < 30)
- {
- count++;
- posInside -= dir * step;
- value = getValue(posInside, i);
- }
- posOutside = point;
- }
- else
- {
- posOutside = point;
- while(value<0 && count < 30)
- {
- count++;
- posOutside += dir * step;
- value = getValue(posOutside, i);
- }
- posInside = point;
-
- }
- if (count == 30)
- {
- dmsg_warning() << "no projection found in ImplSurf::projectPointonSurface(Vec3d& point, Vec3d& dir)";
- return false;
- }
- return computeSegIntersection(posInside, posOutside, point, i);
-
-
-}
-
-
-bool ScalarField::projectPointOutOfSurface(Vec3d& point, int i, Vec3d& dir, double &dist_out)
-{
-
-
- if (projectPointonSurface2(point, i, dir))
- {
- Vec3d grad = getGradient(point, i);
- grad.normalize();
- point += grad*dist_out;
- return true;
- }
- dmsg_warning() << " problem while computing 'projectPointOutOfSurface" ;
- return false;
-
-
-}
-
-} /// namespace _scalarfield_
-
-} /// namespace geometry
-
-} /// namespace component
-
-} /// namespace sofa
diff --git a/applications/plugins/SofaImplicitField/components/geometry/ScalarField.h b/applications/plugins/SofaImplicitField/components/geometry/ScalarField.h
deleted file mode 100644
index d676dd2e8d4..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/ScalarField.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-/******************************************************************************
-* Contributors:
-* - damien.marchal@univ-lille.fr
-* - olivier.goury@inria.fr
-******************************************************************************/
-
-#ifndef SOFAIMPLICITFIELD_COMPONENT_SCALARFIELD_H
-#define SOFAIMPLICITFIELD_COMPONENT_SCALARFIELD_H
-#include
-
-#include
-#include
-
-namespace sofa::component::geometry
-{
-
-namespace _scalarfield_
-{
-
-using BaseObject [[deprecated("Use sofa::core::objectmodel::BaseObject instead.")]] = sofa::core::objectmodel::BaseObject;
-using sofa::type::Vec3d ;
-using sofa::type::Mat3x3 ;
-
-////////////////// ///////////////
-class SOFA_SOFAIMPLICITFIELD_API ScalarField : public BaseObject
-{
-public:
- SOFA_CLASS(ScalarField, BaseObject);
-
-public:
- void init() override;
-
- /// Compute the gradient using a first order finite-difference scheme.
- /// This is of lower precision compared to analytical gradient computed by derivating
- /// the equations.
- Vec3d getGradientByFinitDifference(Vec3d& pos, int& domain) ;
- void getHessianByCentralFiniteDifference(const Vec3d& x, const double dx,
- Mat3x3& hessian);
- virtual int getDomain(Vec3d& pos, int domain) {
- SOFA_UNUSED(pos);
- SOFA_UNUSED(domain);
- return -1;
- }
-
- virtual double getValue(Vec3d& pos, int& domain) = 0;
- inline double getValue(Vec3d& pos) { int domain=-1; return getValue(pos,domain); }
-
- /// By default compute the gradient using a first order finite difference approache
- /// If you have analytical derivative don't hesitate to override this function.
- virtual Vec3d getGradient(Vec3d& pos, int& domain);
- inline Vec3d getGradient(Vec3d& pos) {int domain=-1; return getGradient(pos,domain); }
- virtual void getHessian(Vec3d &Pos, Mat3x3& h);
-
- /// Returns the value and the gradiant by evaluating one after an other.
- /// For some computation it is possible to implement more efficiently the computation
- /// By factoring the computing of the two...if you can do this please override this function.
- virtual void getValueAndGradient(Vec3d& pos, double &value, Vec3d& grad, int& domain) ;
- inline void getValueAndGradient(Vec3d& pos, double &value, Vec3d& grad)
- {
- int domain=-1;
- return getValueAndGradient(pos,value,grad,domain);
- }
-
- virtual bool computeSegIntersection(Vec3d& posInside, Vec3d& posOutside, Vec3d& intersecPos, int domain=-1);
- bool computeSegIntersection(Vec3d& posInside, double valInside, Vec3d& gradInside,
- Vec3d& posOutside, double valOutside, Vec3d& gradOutside,
- Vec3d& intersecPos, int domain=-1)
- {
- (void)valInside;
- (void)gradInside;
- (void)valOutside;
- (void)gradOutside;
- return computeSegIntersection(posInside, posOutside, intersecPos, domain);
- }
-
- virtual void projectPointonSurface(Vec3d& point, int i=-1);
- void projectPointonSurface(Vec3d& point, double value, Vec3d& grad, int domain=-1)
- {
- (void)value;
- (void)grad;
- projectPointonSurface(point, domain);
- }
-
- // TODO mettre les paramètres step=0.1 & countMax=30 en paramètre
- virtual bool projectPointonSurface2(Vec3d& point, int i, Vec3d& dir);
- bool projectPointonSurface2(Vec3d& point, int domain=-1)
- {
- Vec3d dir = Vec3d(0,0,0);
- return projectPointonSurface2(point, domain, dir);
- }
-
- virtual bool projectPointOutOfSurface(Vec3d& point, int i, Vec3d& dir, double &dist_out);
- bool projectPointOutOfSurface(Vec3d& point, int domain=-1)
- {
- Vec3d dir;
- double dist_out = 0.0;
- return projectPointOutOfSurface(point, domain, dir, dist_out);
- }
-
-
-protected:
- Data< double > d_epsilon; ///< Tolerance when evaluating the gradient and/or the hessian of the implicit surface numerically
- ScalarField( )
- : d_epsilon(initData(&d_epsilon,0.00001,"epsilon","Tolerance when evaluating the gradient and/or the hessian of the implicit surface numerically"))
- {
- }
- ~ScalarField() override { }
-
-private:
- ScalarField(const ScalarField& n) ;
- ScalarField& operator=(const ScalarField& n) ;
-};
-
-
-} /// namespace _scalarfield_
-
-using _scalarfield_::ScalarField ;
-
-} /// namespace sofa::component::geometry
-
-#endif
-
diff --git a/applications/plugins/SofaImplicitField/components/geometry/SphericalField.cpp b/applications/plugins/SofaImplicitField/components/geometry/SphericalField.cpp
deleted file mode 100644
index 14b0c52c6f0..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/SphericalField.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#include
-#include
-using sofa::core::RegisterObject ;
-
-#include "SphericalField.h"
-
-namespace sofa::component::geometry::_sphericalfield_
-{
-
-SphericalField::SphericalField()
- : d_inside(initData(&d_inside, false, "inside", "If true the field is oriented inside (resp. outside) the sphere. (default = false)"))
- , d_radiusSphere(initData(&d_radiusSphere, 1.0, "radius", "Radius of Sphere emitting the field. (default = 1)"))
- , d_centerSphere(initData(&d_centerSphere, Vec3d(0.0,0.0,0.0), "center", "Position of the Sphere Surface. (default=0 0 0)" ))
-{init();
- }
-
-void SphericalField::init()
-{
- m_inside = d_inside.getValue();
- m_center = d_centerSphere.getValue();
- m_radius = d_radiusSphere.getValue();
-}
-
-void SphericalField::reinit()
-{
- init();
-}
-
-double SphericalField::getValue(Vec3d& Pos, int& domain)
-{
- SOFA_UNUSED(domain) ;
- double result = (Pos[0] - m_center[0])*(Pos[0] - m_center[0]) +
- (Pos[1] - m_center[1])*(Pos[1] - m_center[1]) +
- (Pos[2] - m_center[2])*(Pos[2] - m_center[2]) -
- m_radius * m_radius ;
- if(m_inside)
- result = -result;
-
- return result;
-}
-
-Vec3d SphericalField::getGradient(Vec3d &Pos, int &domain)
-{
- SOFA_UNUSED(domain);
- Vec3d g;
- if (m_inside)
- {
- g[0] = -2* (Pos[0] - m_center[0]);
- g[1] = -2* (Pos[1] - m_center[1]);
- g[2] = -2* (Pos[2] - m_center[2]);
- }
- else
- {
- g[0] = 2* (Pos[0] - m_center[0]);
- g[1] = 2* (Pos[1] - m_center[1]);
- g[2] = 2* (Pos[2] - m_center[2]);
- }
-
- return g;
-}
-
-void SphericalField::getValueAndGradient(Vec3d& Pos, double &value, Vec3d& /*grad*/, int& domain)
-{
- SOFA_UNUSED(domain);
- Vec3d g;
- g[0] = (Pos[0] - m_center[0]);
- g[1] = (Pos[1] - m_center[1]);
- g[2] = (Pos[2] - m_center[2]);
- if (m_inside)
- {
- value = m_radius*m_radius - g.norm2();
- g = g * (-2);
- }
- else
- {
- value = g.norm2() - m_radius*m_radius;
- g = g * 2;
- }
-
- return;
-}
-
-
-// Register in the Factory
-void registerSphericalField(sofa::core::ObjectFactory* factory)
-{
- factory->registerObjects(sofa::core::ObjectRegistrationData("A spherical implicit field.")
- .add< SphericalField >());
-}
-
-} /// sofa::component::geometry::_sphericalfield_
diff --git a/applications/plugins/SofaImplicitField/components/geometry/SphericalField.h b/applications/plugins/SofaImplicitField/components/geometry/SphericalField.h
deleted file mode 100644
index 6880a14ec25..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/SphericalField.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#ifndef SOFA_IMPLICIT_SPHERICALFIELD_H
-#define SOFA_IMPLICIT_SPHERICALFIELD_H
-
-#include "ScalarField.h"
-
-namespace sofa
-{
-
-namespace component
-{
-
-namespace geometry
-{
-
-namespace _sphericalfield_
-{
-
-using sofa::type::Vec3d ;
-
-class SOFA_SOFAIMPLICITFIELD_API SphericalField : public ScalarField
-{
-public:
- SOFA_CLASS(SphericalField, ScalarField);
-
-public:
- SphericalField() ;
- ~SphericalField() override { }
-
- /// Inherited from BaseObject
- void init() override ;
- void reinit() override ;
-
- /// Inherited from ScalarField.
- double getValue(Vec3d& Pos, int &domain) override ;
- Vec3d getGradient(Vec3d &Pos, int& domain) override ;
- void getValueAndGradient(Vec3d& pos, double& val, Vec3d& grad, int& domain) override ;
-
- using ScalarField::getValue ;
- using ScalarField::getGradient ;
- using ScalarField::getValueAndGradient ;
-
- Data d_inside; ///< If true the field is oriented inside (resp. outside) the sphere. (default = false)
- Data d_radiusSphere; ///< Radius of Sphere emitting the field. (default = 1)
- Data d_centerSphere; ///< Position of the Sphere Surface. (default=0 0 0)
-
-protected:
- Vec3d m_center;
- double m_radius;
- bool m_inside;
-};
-
-} /// _sphericalfield_
-
-using _sphericalfield_::SphericalField ;
-
-} /// geometry
-
-} /// component
-
-} /// sofa
-
-#endif
diff --git a/applications/plugins/SofaImplicitField/components/geometry/StarShapedField.cpp b/applications/plugins/SofaImplicitField/components/geometry/StarShapedField.cpp
deleted file mode 100644
index f41b2d75880..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/StarShapedField.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#include
-#include
-using sofa::core::RegisterObject ;
-
-#include "StarShapedField.h"
-
-namespace sofa::component::geometry::_StarShapedField_
-{
-
-
-StarShapedField::StarShapedField()
- : d_inside(initData(&d_inside, false, "inside", "If true the field is oriented inside (resp. outside) the sphere. (default = false)"))
- , d_radiusSphere(initData(&d_radiusSphere, 1.0, "radius", "Radius of Sphere emitting the field. (default = 1)"))
- , d_centerSphere(initData(&d_centerSphere, Vec3d(0.0,0.0,0.0), "center", "Position of the Sphere Surface. (default=0 0 0)" ))
- , d_branches(initData(&d_branches, 1.0, "branches", "Number of branches of the star. (default=1)" ))
- , d_branchesRadius(initData(&d_branchesRadius, 1.0, "branchesRadius", "Size of the branches of the star. (default=1)" ))
-{
- init();
- addUpdateCallback("myUpdateCallback", {&d_inside, &d_radiusSphere, &d_centerSphere, &d_branches, &d_branchesRadius}, [this](const core::DataTracker& t)
- {
- SOFA_UNUSED(t);
- this->init();
- return sofa::core::objectmodel::ComponentState::Valid;
- }, {});
-
-}
-
-void StarShapedField::init()
-{
- m_inside = d_inside.getValue();
- m_center = d_centerSphere.getValue();
- m_radius = d_radiusSphere.getValue();
- m_branches = d_branches.getValue();
- m_branchesRadius = d_branchesRadius.getValue();
-}
-
-void StarShapedField::reinit()
-{
- init();
-}
-
-double StarShapedField::getValue(Vec3d& Pos, int& domain)
-{
- SOFA_UNUSED(domain) ;
- double length = sqrt((Pos[0] - m_center[0])*(Pos[0] - m_center[0]) +
- (Pos[1] - m_center[1])*(Pos[1] - m_center[1]) +
- (Pos[2] - m_center[2])*(Pos[2] - m_center[2]));
- double result = length - m_radius ;
-
- double simpleCos0 = (Pos[0] - m_center[0]);
- double simpleCos1 = (Pos[1] - m_center[1]);
- double simpleCos2 = (Pos[2] - m_center[2]);
-
- result += m_branchesRadius * ( cos( m_branches*simpleCos0 ) + cos( m_branches*simpleCos1 ) + cos( m_branches*simpleCos2 ) );
- if(m_inside)
- result = -result;
-
- return result;
-}
-
-Vec3d StarShapedField::getGradient(Vec3d &Pos, int &domain)
-{
- SOFA_UNUSED(domain);
- Vec3d g;
-
- double length = sqrt((Pos[0] - m_center[0])*(Pos[0] - m_center[0]) +
- (Pos[1] - m_center[1])*(Pos[1] - m_center[1]) +
- (Pos[2] - m_center[2])*(Pos[2] - m_center[2]));
- double deltaLength0 = (Pos[0] - m_center[0])/length;
- double deltaLength1 = (Pos[1] - m_center[1])/length;
- double deltaLength2 = (Pos[2] - m_center[2])/length;
-
- g[0] = deltaLength0 - m_branchesRadius*m_branches*sin(m_branches*(Pos[0] - m_center[0]));
- g[1] = deltaLength1 - m_branchesRadius*m_branches*sin(m_branches*(Pos[1] - m_center[1]));
- g[2] = deltaLength2 - m_branchesRadius*m_branches*sin(m_branches*(Pos[2] - m_center[2]));
-
- if (m_inside)
- {
- g[0] = -g[0];
- g[1] = -g[1];
- g[2] = -g[2];
- }
-
- return g;
-}
-
-void StarShapedField::getHessian(Vec3d &Pos, Mat3x3& h)
-{
- double length = sqrt((Pos[0] - m_center[0])*(Pos[0] - m_center[0]) +
- (Pos[1] - m_center[1])*(Pos[1] - m_center[1]) +
- (Pos[2] - m_center[2])*(Pos[2] - m_center[2]));
- double deltaLength0 = (Pos[0] - m_center[0])/length;
- double deltaLength1 = (Pos[1] - m_center[1])/length;
- double deltaLength2 = (Pos[2] - m_center[2])/length;
-
-
- h[0][0] = (length - (Pos[0] - m_center[0])*deltaLength0 )/(length*length) - m_branchesRadius*m_branches*m_branches*cos(m_branches*(Pos[0] - m_center[0]));
- h[1][1] = (length - (Pos[1] - m_center[1])*deltaLength1 )/(length*length) - m_branchesRadius*m_branches*m_branches*cos(m_branches*(Pos[1] - m_center[1]));
- h[2][2] = (length - (Pos[2] - m_center[2])*deltaLength2 )/(length*length) - m_branchesRadius*m_branches*m_branches*cos(m_branches*(Pos[2] - m_center[2]));
-
- h[0][1] = h[1][0] = - (Pos[0] - m_center[0])*(Pos[1] - m_center[1]) / (length*length*length);
- h[0][2] = h[2][0] = - (Pos[0] - m_center[0])*(Pos[2] - m_center[2]) / (length*length*length);
- h[1][2] = h[2][1] = - (Pos[2] - m_center[2])*(Pos[1] - m_center[1]) / (length*length*length);
-
- return;
-}
-
-// Register in the Factory
-void registerStarShapedField(sofa::core::ObjectFactory* factory)
-{
- factory->registerObjects(sofa::core::ObjectRegistrationData("A star-shape implicit field.")
- .add< StarShapedField >());
-}
-
-} // namespace sofa::component::geometry::_StarShapedField_
-
diff --git a/applications/plugins/SofaImplicitField/components/geometry/StarShapedField.h b/applications/plugins/SofaImplicitField/components/geometry/StarShapedField.h
deleted file mode 100644
index 1d0aebb33b7..00000000000
--- a/applications/plugins/SofaImplicitField/components/geometry/StarShapedField.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#pragma once
-
-#include "ScalarField.h"
-#include
-
-namespace sofa::component::geometry
-{
-
-namespace _StarShapedField_
-{
-
-using sofa::type::Vec3d;
-using sofa::type::Mat3x3;
-
-/**
- * This component emulates an implicit field that looks like some kind of star.
-*/
-class SOFA_SOFAIMPLICITFIELD_API StarShapedField : public ScalarField
-{
-public:
- SOFA_CLASS(StarShapedField, ScalarField);
-
-public:
- StarShapedField() ;
- ~StarShapedField() override { }
-
- /// Inherited from BaseObject
- void init() override ;
- void reinit() override ;
-
- /// Inherited from ScalarField.
- double getValue(Vec3d& Pos, int &domain) override ;
- Vec3d getGradient(Vec3d &Pos, int& domain) override ;
- void getHessian(Vec3d &Pos, Mat3x3& h) override;
-
- using ScalarField::getValue ;
- using ScalarField::getGradient ;
- using ScalarField::getValueAndGradient ;
-
- Data d_inside; ///< If true the field is oriented inside (resp. outside) the sphere. (default = false)
- Data d_radiusSphere; ///< Radius of Sphere emitting the field. (default = 1)
- Data d_centerSphere; ///< Position of the Sphere Surface. (default=0 0 0)
- Data d_branches; ///< Number of branches of the star. (default=1)
- Data d_branchesRadius; ///< Size of the branches of the star. (default=1)
-protected:
- Vec3d m_center;
- double m_radius;
- bool m_inside;
- double m_branches;
- double m_branchesRadius;
-};
-
-} // namespace _StarShapedField_
-
-using sofa::component::geometry::_StarShapedField_::StarShapedField;
-
-} // namespace sofa::component::geometry
-
diff --git a/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.cpp b/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.cpp
deleted file mode 100644
index 9609e654e7f..00000000000
--- a/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#define SOFA_COMPONENT_MAPPING_IMPLICITSURFACEMAPPING_CPP
-#include
-#include
-#include "ImplicitSurfaceMapping.inl"
-
-namespace sofaimplicitfield::mapping
-{
-
-using namespace sofa::defaulttype;
-
-// Register in the Factory
-void registerImplicitSurfaceMapping(sofa::core::ObjectFactory* factory)
-{
- factory->registerObjects(sofa::core::ObjectRegistrationData("Compute an iso-surface from a set of particles.")
- .add< ImplicitSurfaceMapping< Vec3dTypes, Vec3dTypes > >());
-}
-
-template class SOFA_SOFAIMPLICITFIELD_API ImplicitSurfaceMapping< Vec3dTypes, Vec3dTypes >;
-
-}
diff --git a/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.h b/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.h
deleted file mode 100644
index 6b66ece9bd8..00000000000
--- a/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#pragma once
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-namespace sofaimplicitfield::mapping
-{
-
-using namespace sofa;
-using sofa::component::topology::container::constant::MeshTopology;
-
-template
-class ImplicitSurfaceMapping : public core::Mapping, public MeshTopology
-{
-public:
- SOFA_CLASS2(SOFA_TEMPLATE2(ImplicitSurfaceMapping, In, Out), SOFA_TEMPLATE2(core::Mapping, In, Out), MeshTopology);
-
- typedef core::Mapping Inherit;
- typedef typename Out::VecCoord OutVecCoord;
- typedef typename Out::VecDeriv OutVecDeriv;
- typedef typename Out::Coord OutCoord;
- typedef typename Out::Deriv OutDeriv;
- typedef typename OutCoord::value_type OutReal;
- typedef typename In::VecCoord InVecCoord;
- typedef typename In::VecDeriv InVecDeriv;
- typedef typename In::Coord InCoord;
- typedef typename In::Deriv InDeriv;
- typedef typename InCoord::value_type InReal;
-
- typedef typename In::MatrixDeriv InMatrixDeriv;
- typedef typename Out::MatrixDeriv OutMatrixDeriv;
-
- typedef Data InDataVecCoord;
- typedef Data InDataVecDeriv;
- typedef Data InDataMatrixDeriv;
-
- typedef Data OutDataVecCoord;
- typedef Data OutDataVecDeriv;
- typedef Data OutDataMatrixDeriv;
-protected:
- ImplicitSurfaceMapping()
- : Inherit(),
- mStep(initData(&mStep,0.5,"step","Step")),
- mRadius(initData(&mRadius,2.0,"radius","Radius")),
- mIsoValue(initData(&mIsoValue,0.5,"isoValue","Iso Value")),
- mGridMin(initData(&mGridMin,InCoord(-100,-100,-100),"min","Grid Min")),
- mGridMax(initData(&mGridMax,InCoord(100,100,100),"max","Grid Max"))
- {
- }
-
- ~ImplicitSurfaceMapping() override
- {
- }
-public:
- void init() override;
-
- void parse(core::objectmodel::BaseObjectDescription* arg) override;
-
- double getStep() const { return mStep.getValue(); }
- void setStep(double val) { mStep.setValue(val); }
-
- double getRadius() const { return mRadius.getValue(); }
- void setRadius(double val) { mRadius.setValue(val); }
-
- double getIsoValue() const { return mIsoValue.getValue(); }
- void setIsoValue(double val) { mIsoValue.setValue(val); }
-
- const InCoord& getGridMin() const { return mGridMin.getValue(); }
- void setGridMin(const InCoord& val) { mGridMin.setValue(val); }
- void setGridMin(double x, double y, double z) { mGridMin.setValue( InCoord((InReal)x,(InReal)y,(InReal)z)); }
-
- const InCoord& getGridMax() const { return mGridMax.getValue(); }
- void setGridMax(const InCoord& val) { mGridMax.setValue(val); }
- void setGridMax(double x, double y, double z) { mGridMax.setValue( InCoord((InReal)x,(InReal)y,(InReal)z)); }
-
- void apply(const core::MechanicalParams *mparams, Data& out, const Data& in) override;
- void applyJ(const core::MechanicalParams *mparams, Data& out, const Data& in) override;
- void applyJT( const sofa::core::MechanicalParams* /*mparams*/, InDataVecDeriv& /*out*/, const OutDataVecDeriv& /*in*/) override
- {
- msg_error() << "applyJT(dx) is not implemented";
- }
-
- void applyJT( const sofa::core::ConstraintParams* /*cparams*/, InDataMatrixDeriv& /*out*/, const OutDataMatrixDeriv& /*in*/) override
- {
- msg_error() << "applyJT(constraint) is not implemented";
- }
-
- void draw(const core::visual::VisualParams* params) override;
-
-protected:
- Data mStep; ///< Step
- Data mRadius; ///< Radius
- Data mIsoValue; ///< Iso Value
-
- Data< InCoord > mGridMin; ///< Grid Min
- Data< InCoord > mGridMax; ///< Grid Max
-
- Vec3d mLocalGridMin; ///< Grid Min
- Vec3d mLocalGridMax; ///< Grid Max
-
-
- // Marching cube data
-
- /// For each cube, store the vertex indices on each 3 first edges, and the data value
- struct CubeData
- {
- int p[3];
- OutReal data;
- inline friend std::istream& operator >> ( std::istream& in, CubeData& c)
- {
- in >> c.p[0] >> c.p[1] >> c.p[2] >> c.data;
-
- return in;
- }
-
- inline friend std::ostream& operator << ( std::ostream& out, const CubeData& c)
- {
- out << c.p[0] << " " << c.p[1] << " " << c.p[2] << " " << c.data ;
- return out;
- }
- };
-
- Data < sofa::type::vector > planes;
- typename sofa::type::vector::iterator P0; /// Pointer to first plane
- typename sofa::type::vector::iterator P1; /// Pointer to second plane
-public:
- bool insertInNode( core::objectmodel::BaseNode* node ) override { Inherit1::insertInNode(node); Inherit2::insertInNode(node); return true; }
- bool removeInNode( core::objectmodel::BaseNode* node ) override { Inherit1::removeInNode(node); Inherit2::removeInNode(node); return true; }
-
-private:
- MarchingCube marchingCube;
-};
-
-#if !defined(SOFA_COMPONENT_MAPPING_IMPLICITSURFACEMAPPING_CPP)
-extern template class SOFA_SOFAIMPLICITFIELD_API ImplicitSurfaceMapping< defaulttype::Vec3dTypes, defaulttype::Vec3dTypes >;
-#endif
-
-} // namespace
-
diff --git a/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.inl b/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.inl
deleted file mode 100644
index 267b73e3fc3..00000000000
--- a/applications/plugins/SofaImplicitField/components/mapping/ImplicitSurfaceMapping.inl
+++ /dev/null
@@ -1,164 +0,0 @@
-/******************************************************************************
-* SOFA, Simulation Open-Framework Architecture *
-* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU Lesser General Public License as published by *
-* the Free Software Foundation; either version 2.1 of the License, or (at *
-* your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but WITHOUT *
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
-* for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with this program. If not, see . *
-*******************************************************************************
-* Authors: The SOFA Team and external contributors (see Authors.txt) *
-* *
-* Contact information: contact@sofa-framework.org *
-******************************************************************************/
-#pragma once
-
-#include "ImplicitSurfaceMapping.h"
-#include
-#include
-#include