Skip to content

Commit 259a75d

Browse files
committed
[doc] Add usage example in README
1 parent ca69ea9 commit 259a75d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,59 @@ plugin by InfinyTech3D for an enhanced simulation experience. Contact us for mor
2323
- Support for haptic feedback such as resistance during puncture and friction during insertion
2424
- Compatible with SOFA-Unity integration for real-time interactive applications
2525

26+
## Usage
27+
28+
- To use the plugin, include the `CollisionAlgorithm` plugin in your SOFA .xml scene file.
29+
30+
``` <RequiredPlugin name=`CollisionAlgorithm`/> ```
31+
- Add the `CollisionLoop` component in the root node of your scene.
32+
33+
```
34+
<FreeMotionAnimationLoop/>
35+
<ProjectedGaussSeidelConstraintSolver tolerance='<your tolerance>' maxIt='<maximum solver iterations>' />
36+
<CollisionLoop/>
37+
38+
<CollisionPipeline/>
39+
<BruteForceBroadPhase/>
40+
<BVHNarrowPhase/>
41+
<CollisionResponse name='response' response='FrictionContactConstraint'/>
42+
<LocalMinDistance name='proximity' alarmDistance='0.2' contactDistance='0.08'/>
43+
```
44+
This component substitutes the default `CollisionPipeline` and manages the needle insertion algorithm.
45+
However, the two components can co-exist, allowing users to mix the standard collision detection/constraint resolution pipelines of SOFA.
46+
47+
- Create a node to represent the needle and additional nodes for the needle tip and shaft geometries
48+
Refer to the `scenes/NeedleInsertion.xml` example scene for guidance.
49+
50+
- Add an `InsertionAlgorithm` component inside the needle node as shown below.
51+
```
52+
<Node name='needleInsertion'>
53+
<InsertionAlgorithm name='algorithm'
54+
tipGeom='@<path to needle tip geometry component>'
55+
shaftGeom='@<path to needle shaft geometry component>'
56+
surfGeom='@<path to tissue surface geometry component>'
57+
volGeom='@<path to tissue volume geometry component>'
58+
punctureForceThreshold='<float>'
59+
tipDistThreshold='<float>'
60+
/>
61+
<DistanceFilter algo='@algorithm' distance='<float>'/>
62+
<SecondDirection name='punctureDirection'
63+
handler='@<path to the tissue surface triangle handler>'
64+
/>
65+
<ConstraintUnilateral name='punctureConstraint'
66+
input='@algoSkin.collisionOutput'
67+
directions='@punctureDirection'
68+
mu='<float>'
69+
/>
70+
<FirstDirection name='bindDirection' handler='@<path to the normal handler of the needle beam'/>
71+
<ConstraintInsertion name='insertionConstraint'
72+
input='@algorithm.insertionOutput'
73+
directions='@bindDirection'
74+
frictionCoeff='<float>'
75+
/>
76+
</Node>
77+
```
78+
2679
## Installation and Setup
2780

2881
First review the official SOFA documentation for building and registering SOFA plugins

0 commit comments

Comments
 (0)