Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
667 commits
Select commit Hold shift + click to select a range
3ad5262
improving polar decomposition by scaling down the computed angle
Jul 8, 2012
b129af5
changing SCA 2012 to Vriphys 2012
Jul 9, 2012
d9545d9
changing from SCA 2012 to Vriphys 2012
Jul 9, 2012
f906ea8
update old scenes
Jul 11, 2012
ea3bcbe
more on the article
Jul 13, 2012
66935b8
fixing a figure
Jul 13, 2012
fc2e316
Doxygen documentation
Jul 15, 2012
2297f00
more on the article
Jul 18, 2012
18aba3d
setting svn:ignore property
Jul 18, 2012
bb2faee
using 6 Gauss point quadrature for bending element
Jul 18, 2012
0c8650d
modifs in intro
Jul 18, 2012
f510255
reorganizing sections 2 and 3, adding more stuff to sec. 2
Jul 19, 2012
317e316
modifs & comments
Jul 20, 2012
2627bc7
more on article
Jul 25, 2012
0921964
finishing section 2
Jul 25, 2012
b8666ce
article
Jul 27, 2012
31ce646
comments and some update
Jul 29, 2012
3ec5108
begin of something in section 3.1
Jul 29, 2012
439fa7c
trying new image for membrane/bending deformations
Jul 29, 2012
ea60a43
section 3.1
Jul 30, 2012
1608ffe
section 3
Jul 30, 2012
07d96e7
small changes in section 3
Jul 30, 2012
27d5452
rewritten contributon, new images for the paper
Jul 31, 2012
0971e32
article: reviewed end of section 2 and most of section 3
Jul 31, 2012
dc271df
fixing FPS for the test (only visual mapping)
Aug 1, 2012
ac50d4f
sections 3, 4 and most of 5
Aug 1, 2012
d227c07
spell check
Aug 2, 2012
d025bd8
cropping images
Aug 2, 2012
a9b1fc4
application on the birth simulation
Aug 2, 2012
dd28305
abstract
Aug 2, 2012
298ab33
changes in sections 6 and 7
Aug 2, 2012
86b15f8
proofread of section 4
Aug 2, 2012
1e1b0b2
proofread of section 5
Aug 2, 2012
6faa5d1
small corrections
Aug 2, 2012
9786e9f
changes to fit into 10 page limit
Aug 3, 2012
b28c3ee
adding paper outline to introduction
Aug 3, 2012
a4e2457
Precomputing shape functions; removing typing problem with call to ap…
Aug 6, 2012
5ea600a
drawing strain/stress at each gausspoint -- initial skeleton
Sep 6, 2012
cc02b84
measuring the membrane stress
Sep 7, 2012
67555c9
fixing previous commit and making maximal value for colour mapping co…
Sep 7, 2012
b17368b
using von Mises stress criterion to evaluate stress vallues, included…
Sep 13, 2012
0510c67
Dossier papier afig
Sep 20, 2012
48aae52
Corrections + figure
Sep 20, 2012
9146aef
Ajout intro et corrections
Sep 20, 2012
e94dcc2
Papier version finale + figures
Sep 21, 2012
a8c6e40
final version of VRIPHYS paper
Oct 8, 2012
b0b991b
fixing invalid line; removing unused files
Oct 9, 2012
b801cc5
simple controller for optimization of 2D mesh (for testing purposes)
Oct 12, 2012
52e91cc
Multiple iterations of Laplacian smoothing
Oct 12, 2012
39485cd
optimization based smoothing
Oct 23, 2012
38adcf5
Afig paper removed (non longer needed)
Oct 24, 2012
4678aaf
Implementation of smoothing algorithm by Pain et al.
Oct 26, 2012
aa72b53
compute values at nodes
Oct 30, 2012
dbd7730
CUDA implementation of Laplacian smoothing
Nov 9, 2012
01f305c
CUDA implementation of optimization based smoothin
Nov 12, 2012
843026a
preparation for parallelization; support for topological changes, poi…
Nov 19, 2012
f738b7a
first working version of point tracking
Nov 19, 2012
c237f61
making CUDA optional
Nov 20, 2012
c0bcd80
fixing comments (for doxygen)
Nov 22, 2012
0b35f12
- Having both boundary and fixed nodes (allowing boundary nodes to mo…
Nov 23, 2012
25c1ddd
fixing #includes
Nov 27, 2012
647c5d4
Computing stress/strain on mapped topology
Nov 27, 2012
7da5378
using DataDisplay to draw stress
Nov 27, 2012
36ac2e2
reattach point to avoid degenerated elements
Nov 30, 2012
02e8405
preparing for the adaptive cutting
Nov 30, 2012
e8718a2
more work on the cutting framework (little bit broken now)
Dec 4, 2012
9775022
more on the cutting
Dec 5, 2012
e03976a
first working version of cutting support (not yet perfect though)
Dec 12, 2012
2386627
small fixes to cutting, fixed boundary recheck
Dec 13, 2012
f3ac243
fixing compilation with new Sofa
Jan 11, 2013
681c0e3
computing stress/strain for some elements in TriangularShellForceField
Jan 16, 2013
e8c8bfc
removing stress drawing code from BezierShellForceField and renaming …
Jan 16, 2013
8e5bd74
- removing distinction between tracked and "last seen" point position
Jan 17, 2013
22c101e
adding class for projection of points on surface
Jan 21, 2013
e3d5e1e
handling point projection during adaptivity
Jan 21, 2013
1a87113
removing CUDA classes from build (broken)
Jan 21, 2013
5a621c4
fixing some cut-point selection problems
Jan 23, 2013
00f3520
fixing computation of stress/strain
Jan 25, 2013
3ff8a78
implementing edge swapping operation
Jan 25, 2013
ea99659
Refactoring adaptive cutting into separate component
Jan 28, 2013
56c60d2
adding mesh
Jan 28, 2013
61dc091
Added edge protection code and tracked point swapping method to compl…
Jan 29, 2013
369c497
bugfix
Jan 29, 2013
352de3b
fixing compilation
Jan 29, 2013
f15a258
removing unwanted property svn:mime-type
Jan 29, 2013
7b69288
scenes combining tetrahedral forcefield with shells
Feb 6, 2013
684ec21
scenes
Feb 11, 2013
944c178
scenes
Feb 11, 2013
b0c7c82
scenes
Feb 11, 2013
35c76f6
renaming old directory
Feb 17, 2013
4a67e16
adding first lines for MICCAI 2013 paper
Feb 18, 2013
ff98a7b
fixing integration of the DKT element
Feb 18, 2013
9ad390d
Component with CST membrane element (because the implementations in S…
Feb 18, 2013
e629bc1
scenes for liver with capsule
Feb 20, 2013
80e3911
fixing path
Feb 20, 2013
cc979f7
more on the miccai paper
Feb 21, 2013
08a4ac1
first version fo aspiration test and results
Feb 25, 2013
19c5630
missing mesh file
Feb 26, 2013
3f035b6
abstract v1.0
Feb 26, 2013
9cb53ea
more on the miccai paper
Feb 27, 2013
fa640fe
the paper
Feb 27, 2013
bed914e
aspiration test
Feb 27, 2013
b3fd805
fixing the solver
Feb 27, 2013
e029b0c
fixing the aspiration test
Feb 28, 2013
52cec00
few comments
Feb 28, 2013
887ad75
ADD: the effect of the force field applied gradually
Feb 28, 2013
c37b916
paper
Feb 28, 2013
e98313d
CHANGE: allowing for both increasin and decreasing the effect of the …
Feb 28, 2013
00a30cf
ADD: introduction
Feb 28, 2013
5f5e2e9
paper: intro, intro to experiments
Feb 28, 2013
71683dd
ADD and CHANGE: some additions and modifications in Model -- Parenchy…
Feb 28, 2013
50ecafb
ADD: overview of "Global deformations" section
Feb 28, 2013
a58dce3
bibliography, comments, figures for aspiration
Feb 28, 2013
ca78a57
TEMPORARY: aspiration.jpg => aspiration.pdf to compile the TeX. Aspir…
Mar 1, 2013
3aa9cd6
adding missing file
Mar 1, 2013
b72eae9
REVERT: pdf => jpg
Mar 1, 2013
ddeb7af
FIX: small fixes in the introduction
Mar 1, 2013
2b8159c
fixing the plot and screenshots
Mar 1, 2013
1b301cb
membrane stiffness matrix
Mar 1, 2013
e4e4bf3
adding references
Mar 1, 2013
03565fa
ADD: graph showing the force evoluation when adding the membrane
Mar 1, 2013
02aad81
paper outline
Mar 1, 2013
ed2cf6a
liver under gravity
Mar 1, 2013
3c93931
changing stiffness of parenchyma
Mar 1, 2013
7b3be1c
small changes
Mar 1, 2013
2ad5741
ADD: part of the global deformation section plus images
Mar 1, 2013
796f51c
ADD: global deformations finished
Mar 1, 2013
a5105d7
CHANGE: small modifications in Local Deformations section
Mar 1, 2013
0c81949
CHANGE: negligible modification of title
Mar 1, 2013
dae58be
adding figure caption
Mar 1, 2013
7154312
removing unnecessary info to make citations shorter
Mar 1, 2013
da3a31b
removing unnecessary stuff to make it shorter; correcting insitutions
Mar 1, 2013
d055fcc
CHANGE: new version of abstract, small modifications in introduction
Mar 2, 2013
0d0413a
ADD: small changes in the text
Mar 2, 2013
525aebd
small fixes
Mar 2, 2013
6698510
spell check, homogenized figure captions
Mar 2, 2013
2e6d301
small changes
Mar 2, 2013
73ec45f
small changes
Mar 2, 2013
09e66a6
final fix
Mar 2, 2013
ddfd794
CHANGE: two important modifs: new mesh sizes and frame rate, max. Hau…
Mar 2, 2013
d0d3d0b
FIX: English and small typos
Mar 2, 2013
c1cbdc8
CHANGE: conclusions
Mar 2, 2013
e616e5b
CHANGE: using stiffnessFactor provided externally to switch on the ca…
Mar 5, 2013
7b54264
CHANGE: default factorStiffness parameter changed to 1
Mar 5, 2013
14c4d9a
ADD: new scenes to compare influence of the capsule using gravity and…
Mar 5, 2013
48e191f
changes for miccai
Mar 7, 2013
224bc37
small cleanups
Mar 8, 2013
5d1dd80
introducint metric tensor
Mar 8, 2013
3c96a78
CHANGE: removed obsolete parameters
Mar 11, 2013
480ade7
small cleanup
Mar 25, 2013
0de4513
adding some form of projection onto surface
Mar 25, 2013
84b6c6a
adapting parametrization to changes in topology (point relocation)
Mar 25, 2013
b94afc9
moving optimization related code to seprate class
Mar 27, 2013
c817aa4
modified optimization to use parametrized surface
Mar 30, 2013
9450239
framework for metric tensors
Apr 11, 2013
1172db8
Paper for VRST 2013 (reworked miccai 2013 paper)
May 21, 2013
35b0047
FIX: caption bug and affiliations
May 28, 2013
6e92c9b
removing vascularization and global deformations
May 28, 2013
39cccf4
vrst2013: aspiration test
May 29, 2013
df12111
vrst2013: more changes
May 30, 2013
638be91
more fixes in the paper
May 30, 2013
d7ef821
reorganizing sections
May 31, 2013
7a9098e
ADD: abstract
May 31, 2013
f1c1bbb
ADD: some reformulations in section 3 and 4
May 31, 2013
30feae7
ADD: citations and further fixes
May 31, 2013
ad0110c
ADD: reformulation in 4. chapter
May 31, 2013
68aaa6c
displacement evolution
May 31, 2013
b79aaed
further reformulations
May 31, 2013
020c52f
ADD: figure
May 31, 2013
02958e7
fixing the figure
May 31, 2013
2b8a308
FIX: i7 CPU
May 31, 2013
5c82a1f
FIX: conclusions
May 31, 2013
1610d51
updating values in figure
May 31, 2013
f9771ed
categories, term, keywords
May 31, 2013
cd20d29
final fixes
May 31, 2013
82fe5b3
changing the time range
May 31, 2013
b8dcf81
moving mapping related code into another interpolation component
Jun 13, 2013
4c6ed6a
implementing applyJT for constraints (not sure it's working though)
Jun 18, 2013
d2328d3
commited wrong version of applyJT
Jun 19, 2013
592cba7
preparing MEDIA paper
Jun 26, 2013
cdbef79
aspiration test
Jul 2, 2013
f8b7e31
adding doxygen documentation
Jul 28, 2013
c879397
using acmsiggraph class
Jul 28, 2013
ab0c3e7
fixing some issues
Jul 29, 2013
94b4c68
FIX: typos
Jul 29, 2013
bab068f
MMVR 2014 paper - 4 pages
Jul 31, 2013
7252b3d
DELETE: unnecessary files under SVN
Aug 1, 2013
424fa61
REMOVE: unnecessary files under SVN
Aug 1, 2013
b094a6e
UPDATE: adding the global influence, reducing the method section
Aug 1, 2013
c84bbd2
ADD: new section about the methods showing the combination of matrices
Aug 1, 2013
e3d3d3c
FIX: finalization of the paper
Aug 2, 2013
e1cde2d
CMakeLists added for shell plugin. Testing required and feedback is w…
Oct 13, 2013
7595481
ADD: proceedings version of the paper
Oct 28, 2013
4b43a5d
RENAME: keep the files, up-to-date version of MMVR14 paper about comp…
Oct 28, 2013
4e85f9b
ADD&CHANGE: various modifications of scenes for MMVR2014
Nov 5, 2013
8aee429
CHANGE: temporary removal of shell components for compilation without…
Nov 5, 2013
df6360d
ADD: new scenes for MMVR validation
Nov 6, 2013
26862e5
fix compilation problems (with cmake): change 'method()' by 'this->me…
Apr 9, 2014
3499a45
Updated component to match new method signatures and deprecations.
Nov 18, 2015
1e35318
tentative update of Cmakelist to match SOFA changes
Feb 22, 2016
da7feb0
Fix build with new sofa buildsystem
Feb 22, 2016
c6004b8
Fix bugs to work with current sofa version
Oct 28, 2016
7bb5abd
FIX= small corrections on scene files
ChristianDuriez Jun 19, 2017
81cbd7e
change the plugin Name
ChristianDuriez Sep 1, 2017
9914641
FIX: change the type of shell FF to get better results
ChristianDuriez Sep 1, 2017
6390b00
ADD: ongoing work on ApplyJt for MatrixDeriv
ChristianDuriez Sep 8, 2017
80cc4dd
olivier-goury Nov 30, 2018
8ec7fcb
olivier-goury Jan 11, 2019
49d1096
rename txt file for authors and license
hugtalbot Feb 3, 2020
545e097
Remove old files (qmake)
hugtalbot Feb 3, 2020
00f33d3
FIX CMake config
hugtalbot Feb 4, 2020
7bd3a91
Fix compilation with v19.12
hugtalbot Feb 4, 2020
03c57db
Reorganize plugin and update CMakelists.txt
hugtalbot Jan 13, 2021
a25cb7b
Move doc
hugtalbot Jan 13, 2021
916ca34
Move examples
hugtalbot Jan 13, 2021
775355f
Set up cpp files for plugin
hugtalbot Jan 13, 2021
6cc0dc6
Fix compilation, path and most warnings
hugtalbot Jan 13, 2021
e9d0700
Clean CMakes
hugtalbot Jan 13, 2021
4d08287
Fix compilation with master 20210317
hugtalbot Mar 17, 2021
15f654e
update the CmakeList according to Sofa code
adagolodjo Mar 18, 2021
f9830d0
Merge branch 'fixCMakeList' into 'master'
Mar 18, 2021
d54ff2b
remove the now-private propagateTopologicalChanges
hugtalbot Mar 24, 2021
95c45f3
intermediate commit for updating towards v21.06
hugtalbot Aug 17, 2021
b352496
Update plugin for v21.06
hugtalbot Aug 17, 2021
6c4ac72
Merge commit
hugtalbot Aug 17, 2021
2e71614
Merge branch 'update_v2106' into 'master'
Nov 4, 2021
f3f0a0f
[all] list of changes:
EulalieCoevoet Feb 17, 2023
d8b4337
[src] fixes changes made by mistake
EulalieCoevoet Feb 17, 2023
a396eed
Merge branch 'pr_fixcompilation' into 'master'
Feb 20, 2023
4bbb9b1
[forcefield] cleaning and examples
EulalieCoevoet Feb 21, 2023
cf9dc9a
Merge branch 'pr_cleaningforcefield' into 'master'
EulalieCoevoet Feb 21, 2023
b487ba7
[src] Fixes compilation, cleaning, and visu
EulalieCoevoet Feb 28, 2023
a4fbf34
Merge branch 'pr_fixescompileandFEM' into 'master'
EulalieCoevoet Feb 28, 2023
8766995
update the Triangular Shell ForceField scene
adagolodjo Jun 13, 2023
b925738
Updated the CMakeList file to correspond to the new Sofa standards.
adagolodjo Oct 11, 2023
5806f39
Updated the CMakeList file to correspond to the new Sofa standards.
adagolodjo Oct 11, 2023
44c60e8
Update data name in forcefield component.
adagolodjo Dec 3, 2023
8a837b4
add ShellsAndBeams, SceneCochlea folder to the pluging
adagolodjo Apr 24, 2024
9fddfe9
Enhancement: Add Support for rest state in TriangularShellForceField …
adagolodjo Apr 25, 2024
a9d53c9
update the code in order to compile with Sofa master
adagolodjo Aug 22, 2024
226f4b6
Refactor TriangularShellForceField: Rename 'f_corotated' to 'd_corota…
adagolodjo Oct 23, 2024
527dad7
correct previous commit
adagolodjo Oct 23, 2024
140410b
Merge main into merged_legacy
alxbilger Apr 7, 2025
1f021ce
move everything that was not already moved
alxbilger Apr 9, 2025
173933f
CMake takes into account the folder with the new name
alxbilger Apr 9, 2025
5b5f48c
remove legacy folder
alxbilger Apr 9, 2025
6b21423
adapt code to the new plugin name and latest SOFA changes
alxbilger Apr 9, 2025
e13c01d
Cleanup the plugin and fix compilation (#12)
alxbilger Apr 30, 2025
9843409
[Examples] Clean xml examples from folder combo/miccai2013 (#11)
Lucas-TJ May 6, 2025
96596e8
Remove superfluous files for a merge of develop into the main branch
alxbilger May 7, 2025
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
97 changes: 87 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ cmake_minimum_required(VERSION 3.12)
project(Shell VERSION 1.0 LANGUAGES CXX)

# Find and load CMake configuration of packages containing this plugin's dependencies
find_package(Sofa.Component.Controller REQUIRED)
find_package(Sofa.Config REQUIRED)
sofa_find_package(Sofa.Component.Controller REQUIRED)
sofa_find_package(Sofa.Component.Topology.Container.Dynamic REQUIRED)
sofa_find_package(Sofa.Component.StateContainer REQUIRED)
sofa_find_package(Sofa.Component.Mapping.Linear REQUIRED)
sofa_find_package(Sofa.GL REQUIRED)

set(README_FILE README.md)

option(SOFA-PLUGIN_SHELLS_ADAPTIVITY "Enables shells adaptivity" OFF)

# List all files
set(SHELL_SRC_DIR src/Shell)
Expand All @@ -13,32 +20,102 @@ set(HEADER_FILES
${SHELL_SRC_DIR}/controller/MeshChangedEvent.h
${SHELL_SRC_DIR}/controller/MeshInterpolator.h
${SHELL_SRC_DIR}/controller/MeshInterpolator.inl
${SHELL_SRC_DIR}/controller/TriangleSwitchExample.h
${SHELL_SRC_DIR}/controller/TriangleSwitchExample.inl
${SHELL_SRC_DIR}/engine/JoinMeshPoints.h
${SHELL_SRC_DIR}/engine/JoinMeshPoints.inl
${SHELL_SRC_DIR}/engine/FindClosePoints.h
${SHELL_SRC_DIR}/engine/FindClosePoints.inl
${SHELL_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.h
${SHELL_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.inl
${SHELL_SRC_DIR}/forcefield/CstFEMForceField.h
${SHELL_SRC_DIR}/forcefield/CstFEMForceField.inl
${SHELL_SRC_DIR}/forcefield/TriangularBendingFEMForceField.h
${SHELL_SRC_DIR}/forcefield/TriangularBendingFEMForceField.inl
${SHELL_SRC_DIR}/forcefield/TriangularShellForceField.h
${SHELL_SRC_DIR}/forcefield/TriangularShellForceField.inl
${SHELL_SRC_DIR}/mapping/BendingPlateMechanicalMapping.h
${SHELL_SRC_DIR}/mapping/BendingPlateMechanicalMapping.inl
${SHELL_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.h
${SHELL_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.inl
${SHELL_SRC_DIR}/misc/PointProjection.h
${SHELL_SRC_DIR}/misc/PointProjection.inl
${SHELL_SRC_DIR}/shells2/fem/BezierShellInterpolation.h
${SHELL_SRC_DIR}/shells2/fem/BezierShellInterpolation.inl
${SHELL_SRC_DIR}/shells2/fem/BezierShellInterpolationM.h
${SHELL_SRC_DIR}/shells2/fem/BezierShellInterpolationM.inl
${SHELL_SRC_DIR}/shells2/forcefield/BezierShellForceField.h
${SHELL_SRC_DIR}/shells2/forcefield/BezierShellForceField.inl
${SHELL_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.h
${SHELL_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.inl
)

set(SOURCE_FILES
${SHELL_SRC_DIR}/initShell.cpp
${SHELL_SRC_DIR}/controller/MeshChangedEvent.cpp
${SHELL_SRC_DIR}/controller/MeshInterpolator.cpp
${SHELL_SRC_DIR}/controller/TriangleSwitchExample.cpp
${SHELL_SRC_DIR}/engine/JoinMeshPoints.cpp
${SHELL_SRC_DIR}/engine/FindClosePoints.cpp
${SHELL_SRC_DIR}/forcefield/BezierTriangularBendingFEMForceField.cpp
${SHELL_SRC_DIR}/forcefield/CstFEMForceField.cpp
${SHELL_SRC_DIR}/forcefield/TriangularBendingFEMForceField.cpp
${SHELL_SRC_DIR}/forcefield/TriangularShellForceField.cpp
${SHELL_SRC_DIR}/mapping/BendingPlateMechanicalMapping.cpp
${SHELL_SRC_DIR}/mapping/BezierTriangleMechanicalMapping.cpp
${SHELL_SRC_DIR}/misc/PointProjection.cpp
${SHELL_SRC_DIR}/shells2/fem/BezierShellInterpolation.cpp
${SHELL_SRC_DIR}/shells2/fem/BezierShellInterpolationM.cpp
${SHELL_SRC_DIR}/shells2/forcefield/BezierShellForceField.cpp
${SHELL_SRC_DIR}/shells2/mapping/BezierShellMechanicalMapping.cpp
)
set(README_FILES
README.md
)

# Create the plugin library.
if(SOFA-PLUGIN_SHELLS_ADAPTIVITY)
set(COMPILER_DEFINE "SOFA_BUILD_SHELLS_ADAPTIVITY")

list(APPEND HEADER_FILES
${SHELL_SRC_DIR}/controller/AdaptiveCuttingController.h
${SHELL_SRC_DIR}/controller/AdaptiveCuttingController.inl
${SHELL_SRC_DIR}/controller/Test2DAdapter.h
${SHELL_SRC_DIR}/controller/Test2DAdapter.inl
${SHELL_SRC_DIR}/misc/Optimize2DSurface.h
${SHELL_SRC_DIR}/misc/Optimize2DSurface.inl
${SHELL_SRC_DIR}/misc/SurfaceParametrization.h
${SHELL_SRC_DIR}/misc/SurfaceParametrization.inl
)

list(APPEND SOURCE_FILES
${SHELL_SRC_DIR}/controller/AdaptiveCuttingController.cpp
${SHELL_SRC_DIR}/controller/Test2DAdapter.cpp
${SHELL_SRC_DIR}/misc/Optimize2DSurface.cpp
${SHELL_SRC_DIR}/misc/SurfaceParametrization.cpp
)

if(SofaGui_FOUND AND SofaOpenglVisual_FOUND)
list(APPEND HEADER_FILES
${SHELL_SRC_DIR}/cutting/AdaptiveCutting.h
)

list(APPEND SOURCE_FILES
${SHELL_SRC_DIR}/cutting/AdaptiveCutting.cpp
)
endif()

endif()


# Create the plugin library
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})

# Link the plugin library to its dependency(ies).
target_link_libraries(${PROJECT_NAME} Sofa.Component.Controller Sofa.Component.StateContainer)
target_link_libraries(${PROJECT_NAME}
Sofa.Component.Controller
Sofa.Component.Topology.Container.Dynamic
Sofa.Component.StateContainer
Sofa.Component.Mapping.Linear
Sofa.GL
)

# Create package Config, Version & Target files.
# Deploy the headers, resources, scenes & examples.
# Set the plugin 'relocatable' if built within SOFA.
# --> see SofaMacros.cmake
sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
PACKAGE_VERSION ${PROJECT_VERSION}
Expand Down
Binary file not shown.
5 changes: 3 additions & 2 deletions examples/xml/ShellTest.scn
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
<SparseLDLSolver template="CompressedRowSparseMatrixMat3x3d"/>
<MeshOBJLoader name="loader" filename="mesh/square1.obj"/>
<MeshTopology name="topology" src="@loader"/>
<MechanicalObject template="Rigid3"/>
<MechanicalObject template="Rigid3d"/>
<UniformMass totalMass="0.005"/>
<BoxROI name="box" box="0 0.9 -0.1 1 1 0.1" drawBoxes="1"/>
<FixedConstraint indices="@box.indices"/>
<FixedProjectiveConstraint indices="@box.indices"/>
<TriangularBendingFEMForceField youngModulus="1.7e3" poissonRatio="0.3" thickness="0.01"/>


<Node name="Visu">

Expand Down
43 changes: 43 additions & 0 deletions src/Shell/controller/AdaptiveCuttingController.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <SofaShells/config.h>
#include <SofaShells/cutting/AdaptiveCuttingController.inl>
#include <sofa/core/ObjectFactory.h>


namespace sofa
{

namespace component
{

namespace controller
{

using namespace sofa::defaulttype;

SOFA_DECL_CLASS(AdaptiveCuttingController)

// Register in the Factory
int AdaptiveCuttingControllerClass = core::RegisterObject(
"Controller that handles the cutting method based on mesh adaptivity.")
#ifdef SOFA_FLOAT
.add< AdaptiveCuttingController<type::Vec3fTypes> >(true) // default template
#else
.add< AdaptiveCuttingController<type::Vec3dTypes> >(true) // default template
# ifndef SOFA_DOUBLE
.add< AdaptiveCuttingController<type::Vec3fTypes> >()
# endif
#endif
;

#ifndef SOFA_FLOAT
template class SOFA_SHELLS_API AdaptiveCuttingController<type::Vec3dTypes>;
#endif //SOFA_FLOAT
#ifndef SOFA_DOUBLE
template class SOFA_SHELLS_API AdaptiveCuttingController<type::Vec3fTypes>;
#endif //SOFA_DOUBLE

} // namespace controller

} // namespace component

} // namespace sofa
169 changes: 169 additions & 0 deletions src/Shell/controller/AdaptiveCuttingController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#ifndef SOFA_COMPONENT_CONTROLLER_ADAPTIVECUTTINGCONTROLLER_H
#define SOFA_COMPONENT_CONTROLLER_ADAPTIVECUTTINGCONTROLLER_H

#include <SofaUserInteraction/Controller.h>

#include <sofa/defaulttype/VecTypes.h>
#include <sofa/type/Vec.h>

#include <sofa/core/behavior/MechanicalState.h>
#include <sofa/core/topology/BaseMeshTopology.h>
#include <sofa/gui/component/performer/MouseInteractor.h>
#include <sofa/component/topology/container/dynamic/TriangleSetTopologyContainer.h>
#include <sofa/component/topology/container/dynamic/TriangleSetTopologyModifier.h>
#include <sofa/component/topology/container/dynamic/TriangleSetTopologyAlgorithms.h>
#include <sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.h>
#include <sofa/core/topology/TopologyData.h>

#include <sofa/helper/map.h>
#include <sofa/type/vector.h>

#include <SofaShells/controller/Test2DAdapter.h>

namespace sofa
{

namespace component
{

namespace controller
{

/// Class to shield the data type
class CuttingAdapter
{
public:
virtual void setTrackedPoint(const collision::BodyPicked &picked) = 0;
virtual void freeTrackedPoint() = 0;
virtual void addCuttingPoint() = 0;
};

template<class DataTypes>
class AdaptiveCuttingController : public Controller, public CuttingAdapter
{
public:
SOFA_CLASS(SOFA_TEMPLATE(AdaptiveCuttingController,DataTypes),Controller);

typedef typename DataTypes::Coord Coord;
typedef typename DataTypes::VecCoord VecCoord;
//typedef typename DataTypes::Deriv Deriv;
//typedef typename DataTypes::VecDeriv VecDeriv;
typedef typename Coord::value_type Real;

typedef sofa::type::Vec<2, Real> Vec2;
typedef sofa::type::Vec<3, Real> Vec3;
//typedef sofa::type::Mat<2,2,Real> Mat22;
//typedef sofa::type::Mat<3,3,Real> Mat33;
//typedef type::vector<Vec2> VecVec2;
//typedef type::vector<Vec3> VecVec3;


typedef sofa::core::topology::BaseMeshTopology::Edge Edge;
typedef sofa::core::topology::BaseMeshTopology::EdgesAroundVertex EdgesAroundVertex;
typedef sofa::component::topology::TriangleSetTopologyContainer::TriangleID Index;
typedef sofa::component::topology::TriangleSetTopologyContainer::Triangle Triangle;
typedef sofa::component::topology::TriangleSetTopologyContainer::TrianglesAroundVertex TrianglesAroundVertex;
typedef sofa::component::topology::TriangleSetTopologyContainer::TrianglesAroundEdge TrianglesAroundEdge;
typedef sofa::component::topology::TriangleSetTopologyContainer::EdgesInTriangle EdgesInTriangle;
typedef sofa::type::vector<Index> VecIndex;

enum { InvalidID = sofa::core::topology::Topology::InvalidID };

/// @brief If geometric functinal drops below this value the attached node
/// is dropped.
Data<Real> m_affinity;

virtual void init();
virtual void reinit();

virtual std::string getTemplateName() const
{
return templateName(this);
}

static std::string templateName(const AdaptiveCuttingController<DataTypes>* = NULL)
{
return DataTypes::Name();
}

void onEndAnimationStep(const double dt);
//void onKeyPressedEvent(core::objectmodel::KeypressedEvent *key);

void draw(const core::visual::VisualParams* vparams);


void setTrackedPoint(const collision::BodyPicked &picked);
void freeTrackedPoint() {
// Detach the point
m_pointId = InvalidID;
// Stop cutting
m_cutPoints = 0;
m_cutEdge = InvalidID;
}
void addCuttingPoint();

/// Whether the cutting is in progress or not.
bool cutting() { return m_cutPoints > 0; }

protected:

AdaptiveCuttingController();


private:

Test2DAdapter<DataTypes>* m_adapter;
sofa::component::topology::TriangleSetTopologyContainer* m_container;
sofa::component::topology::TriangleSetGeometryAlgorithms<DataTypes> *m_algoGeom;
sofa::component::topology::TriangleSetTopologyAlgorithms<DataTypes> *m_algoTopo;
sofa::core::behavior::MechanicalState<DataTypes>* m_state;

// TODO: This should go to cutting config (maybe?)
bool autoCutting;


/// Closest point in the mstate.
Index m_pointId;
/// A point on a surface to attract to (valid only if m_pointId != InvalidID).
Vec3 m_point;
/// Position of m_point projected into rest shape.
Vec3 m_pointRest;
/// @brief Triangle ID inside which m_point is located (valid only if
///m_pointId != InvalidID).
Index m_pointTriId;
/// @brief Number of iterations during which the attached node will not be
/// reattached.
unsigned int m_gracePeriod;

/// @brief Stored index of the first edge to cut when the first cut has
/// been delayed.
Index m_cutEdge;
/// Last cutting point.
Index m_cutLastPoint;
/// Cutting operation to perform in this step.
VecIndex m_cutList;
/// Number of cut points defined.
int m_cutPoints;

void switchPoint(const Vec3 &newPoint, const Index newPointTri,
const Index newID, const Index newCutEdge);

/**
* Set edge planned for the next cut.
*
* @param newCutEdge Index of new edge to use.
* @param bKeepProtection Whether to keep edge protection for previous
* edge.
*/
void setCutEdge(const Index newCutEdge, const bool bKeepProtection=false);

};


} // namespace controller

} // namespace component

} // namespace sofa

#endif // #ifndef SOFA_COMPONENT_CONTROLLER_ADAPTIVECUTTINGCONTROLLER_H
Loading
Loading