Skip to content

Commit 68a00b9

Browse files
authored
[algorithm] Clean up of the InsertionAlgorithm class (#45)
* [src] Added the .clang-format file from main SOFA repository * [algorithm] Removed commented outputDist variable * [algorithm] Added transparency to RGBAColor for the coupling points drawn * [algorithm] Bring back the mstate that was deleted * [algorithm] Set default boolean values for drawing to false * [algorithm] Change name of sphereRadius to drawPointsScale [scene] Adjust scene files * [algorithm] Simplified syntax using typedefs for code brevity * [algorithm] Removed unnecessary sofa:: namespace qualifier * [algorithm] Re-organized variables' definition * [algorithm] Renamed detection output variables to distinguish their use for either puncture or insertion * [algorithm] Renamed link variables to BaseGeometry components [scene] Changed scenes accordingly * Signify that the link is directed at a Geometry object * For the needle, the name signifies whether the Geometry refers to the tip or the shaft * For the punctured volume, the name signifies whether the Geometry will be used for: 1. the puncture and, thus, only the surface is of interest or 2. the insertion and, thus, the volume is now of interest * The user should not care whether puncture/insertion happens "from" the needle to the "destination" surface/volume. The user should be concerned with appropriately defining the tip and shaft geometry as well as the geometries of the punctured volumes and surfaces. * [algorithm] Renamed Geometry iterators, Operations specializations and returned proximities * [algorithm] Renamed threshold variables and re-wrote descriptions [scene] Adjusted scenes accordingly * [algorithm] Simplified link check in doDetection * [algorithm] Simplified pointer checks against nullptr * [algorithm] Format code using .clang-format shipped with main SOFA distro * [algorithm] Replaced auto with ElementIterator::SPtr for clarity for iterators * [algorithm] Replaced auto with BaseProximity::SPtr when returned from Operations functions * [algorithm] Re-use tipProx pointer instead of re-creating one when projective is set to true * [src] Delete .clang-format Not really needed
1 parent 1f24c84 commit 68a00b9

4 files changed

Lines changed: 187 additions & 160 deletions

File tree

scenes/InsertionGeomagic.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,18 @@ def createScene(root):
180180

181181

182182
root.addObject("InsertionAlgorithm", name="InsertionAlgo",
183-
fromGeom="@Needle/tipCollision/geom_tip",
184-
destGeom="@Volume/collision/geom_tri",
185-
fromVol="@Needle/bodyCollision/geom_body",
186-
destVol="@Volume/geom_tetra",
187-
punctureThreshold=2.,
188-
slideDistance=0.003,
183+
tipGeom="@Needle/tipCollision/geom_tip",
184+
surfGeom="@Volume/collision/geom_tri",
185+
shaftGeom="@Needle/bodyCollision/geom_body",
186+
volGeom="@Volume/geom_tetra",
187+
punctureForceThreshold=2.,
188+
tipDistThreshold=0.003,
189189
drawcollision=True,
190-
sphereRadius=0.0001
190+
drawPointsScale=0.0001
191191
)
192192
root.addObject("DistanceFilter",algo="@InsertionAlgo",distance=0.01)
193193
root.addObject("SecondDirection",name="punctureDirection",handler="@Volume/collision/SurfaceTriangles")
194-
root.addObject("ConstraintUnilateral",input="@InsertionAlgo.output",directions="@punctureDirection",draw_scale=0.001, mu=0.001)
194+
root.addObject("ConstraintUnilateral",input="@InsertionAlgo.collisionOutput",directions="@punctureDirection",draw_scale=0.001, mu=0.001)
195195

196196
root.addObject("FirstDirection",name="bindDirection", handler="@Needle/bodyCollision/NeedleBeams")
197-
root.addObject("ConstraintInsertion",input="@InsertionAlgo.outputList", directions="@bindDirection",draw_scale="0.01", frictionCoeff=0.000)
197+
root.addObject("ConstraintInsertion",input="@InsertionAlgo.insertionOutput", directions="@bindDirection",draw_scale="0.01", frictionCoeff=0.000)

scenes/NeedleInsertion.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,18 @@ def createScene(root):
179179

180180

181181
root.addObject("InsertionAlgorithm", name="InsertionAlgo",
182-
fromGeom="@Needle/tipCollision/geom_tip",
183-
destGeom="@Volume/collision/geom_tri",
184-
fromVol="@Needle/bodyCollision/geom_body",
185-
destVol="@Volume/geom_tetra",
186-
punctureThreshold=2.,
187-
slideDistance=0.003,
182+
tipGeom="@Needle/tipCollision/geom_tip",
183+
surfGeom="@Volume/collision/geom_tri",
184+
shaftGeom="@Needle/bodyCollision/geom_body",
185+
volGeom="@Volume/geom_tetra",
186+
punctureForceThreshold=2.,
187+
tipDistThreshold=0.003,
188188
drawcollision=True,
189-
sphereRadius=0.0001
189+
drawPointsScale=0.0001
190190
)
191191
root.addObject("DistanceFilter",algo="@InsertionAlgo",distance=0.01)
192192
root.addObject("SecondDirection",name="punctureDirection",handler="@Volume/collision/SurfaceTriangles")
193-
root.addObject("ConstraintUnilateral",input="@InsertionAlgo.output",directions="@punctureDirection",draw_scale=0.001)
193+
root.addObject("ConstraintUnilateral",input="@InsertionAlgo.collisionOutput",directions="@punctureDirection",draw_scale=0.001)
194194

195195
root.addObject("FirstDirection",name="bindDirection", handler="@Needle/bodyCollision/NeedleBeams")
196-
root.addObject("ConstraintInsertion",input="@InsertionAlgo.outputList", directions="@bindDirection",draw_scale=0.002, frictionCoeff=0.05)
196+
root.addObject("ConstraintInsertion",input="@InsertionAlgo.insertionOutput", directions="@bindDirection",draw_scale=0.002, frictionCoeff=0.05)

scenes/NeedleInsertionCycles.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ def createScene(root):
195195

196196

197197
root.addObject("InsertionAlgorithm", name="InsertionAlgo",
198-
fromGeom="@Needle/tipCollision/geom_tip",
199-
destGeom="@Volume/collision/geom_tri",
200-
fromVol="@Needle/bodyCollision/geom_body",
201-
destVol="@Volume/geom_tetra",
202-
punctureThreshold=2.,
203-
slideDistance=0.003,
198+
tipGeom="@Needle/tipCollision/geom_tip",
199+
surfGeom="@Volume/collision/geom_tri",
200+
shaftGeom="@Needle/bodyCollision/geom_body",
201+
volGeom="@Volume/geom_tetra",
202+
punctureForceThreshold=2.,
203+
tipDistThreshold=0.003,
204204
drawcollision=True,
205-
sphereRadius=0.0001
205+
drawPointsScale=0.0001
206206
)
207207
root.addObject("DistanceFilter",algo="@InsertionAlgo",distance=0.01)
208208
root.addObject("SecondDirection",name="punctureDirection",handler="@Volume/collision/SurfaceTriangles")
209-
root.addObject("ConstraintUnilateral",input="@InsertionAlgo.output",directions="@punctureDirection",draw_scale=0.001, mu=0.001)
209+
root.addObject("ConstraintUnilateral",input="@InsertionAlgo.collisionOutput",directions="@punctureDirection",draw_scale=0.001, mu=0.001)
210210

211211
root.addObject("FirstDirection",name="bindDirection", handler="@Needle/bodyCollision/NeedleBeams")
212-
root.addObject("ConstraintInsertion",input="@InsertionAlgo.outputList", directions="@bindDirection",draw_scale=0.002, frictionCoeff=0.0023)
212+
root.addObject("ConstraintInsertion",input="@InsertionAlgo.insertionOutput", directions="@bindDirection",draw_scale=0.002, frictionCoeff=0.0023)

0 commit comments

Comments
 (0)