Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(HEADER_FILES
${PLUGIN_CGAL_SRC_DIR}/FrontSurfaceReconstruction.h
${PLUGIN_CGAL_SRC_DIR}/UpsamplePointCloud.h
${PLUGIN_CGAL_SRC_DIR}/BooleanOperations.h
${PLUGIN_CGAL_SRC_DIR}/MeshRepulsionEngine.h
)
set(SOURCE_FILES
${PLUGIN_CGAL_SRC_DIR}/initCGALPlugin.cpp
Expand All @@ -30,6 +31,7 @@ set(SOURCE_FILES
${PLUGIN_CGAL_SRC_DIR}/FrontSurfaceReconstruction.cpp
${PLUGIN_CGAL_SRC_DIR}/UpsamplePointCloud.cpp
${PLUGIN_CGAL_SRC_DIR}/BooleanOperations.cpp
${PLUGIN_CGAL_SRC_DIR}/MeshRepulsionEngine.cpp
)
set(README_FILES README.md)

Expand Down
64 changes: 64 additions & 0 deletions scenes/MeshRepulsion.scn
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0"?>
<Node name="root" gravity="0 0 0" dt="0.03" >
<RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin pluginName="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin pluginName="Sofa.Component.Setting"/> <!-- Needed to use components [BackgroundSetting] -->
<RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
<RequiredPlugin pluginName="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
<RequiredPlugin pluginName="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
<RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin pluginName="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass] -->
<RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin pluginName="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
<RequiredPlugin pluginName="CGALPlugin"/>

<BackgroundSetting color="0 0.16862745098 0.21176470588"/>
<VisualStyle displayFlags="showVisual" />

<DefaultAnimationLoop />

<Node name="MasterMesh">
<MeshOBJLoader name="loader" filename="./data/mesh/liver_coarse.obj" triangulate="true"/>
<MechanicalObject name="dofs" position="@loader.position"/>
<MeshTopology name="topology" src="@loader"/>

<Node name="Visual" >
<OglModel name="visu" src="@../loader" color="red"/>
<IdentityMapping input="@../dofs" output="@visu"/>
</Node>
</Node>


<Node name="SlaveMesh">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.0" rayleighMass="1.0" />
<CGLinearSolver iterations="15" name="linear_solver" tolerance="1.0e-5" threshold="1.0e-5" />
<MeshOBJLoader name="loader" filename="./data/mesh/diaphragm.obj" triangulate="true"/>
<MechanicalObject name="dofs" position="@loader.position"/>
<MeshTopology name="topology" src="@loader"/>

<!-- to adapt to the scene -->
<BoxROI name="box_roi" box="-4 3.4 -5 8 4 5" drawBoxes="1"/>
<FixedProjectiveConstraint indices="@[-1].indices" />

<UniformMass totalMass="0.5" />
<!-- gmsh file should be used with tetrahedra to use the mesh spring volume
<MeshSpringForceField name="Springs" tetrasStiffness="400" tetrasDamping="0" /> -->

<TriangularFEMForceField name="FEM" youngModulus="600" poissonRatio="0.3" method="large" />
<TriangularBendingSprings name="BS" stiffness="300" damping="1.0" />

<Node name="Visual" >
<OglModel name="visu" src="@../loader" color="white"/>
<IdentityMapping input="@../dofs" output="@visu"/>
</Node>
</Node>

<MeshRepulsionEngine name="theEngine" masterState="@MasterMesh/dofs" slaveState="@SlaveMesh/dofs"
masterTopology="@MasterMesh/topology" slaveTopology="@SlaveMesh/topology"/>


<!--<VTKExporter name="exporter" filename="data/output.vtu" XMLformat="1" edges="0" tetras="1" listening="true" exportAtBegin="true" cellsDataFields="generator.outputCellData" overwrite="true"/>-->
</Node>
Loading