Needles¶
Needles have physics approximations in iMSTK. There are currently many examples within iMSTK that do implement needles to check out. Amongst others, PBDTissueSurfaceNeedleContact
, PBDTissueVolumeNeedleContact
.
Needle¶
iMSTK currently contains two types of needle definitions. - StraigthNeedle: A single line segment needle. - ArcNeedle: Define with an arc. Also provides a LineMesh for collision.
To setup a PBD simulated StraightNeedle
that is also controlled with a PbdObjectController
one can do:
```cpp
auto toolObj = std::make_shared
auto toolGeometry = std::make_shared
toolObj->setVisualGeometry(toolGeometry); toolObj->setCollidingGeometry(toolGeometry); toolObj->setPhysicsGeometry(toolGeometry); toolObj->setDynamicalModel(model); toolObj->getPbdBody()->setRigid( Vec3d(0.0, 1.0, 0.0), // Position 1.0, // Mass Quatd::Identity(), // Orientation Mat3d::Identity() * 10000.0); // Inertia
// Add a component for controlling via another device
auto controller = toolObj->addComponent
Add the needle component:
Punctureable¶
Needles work in junction with Puncturables. Puncturable exists to keep track of the punctures on a tissue. To define something as puncturable add the component to the toolObj
.
PunctureMap¶
Both Needle and Puncturable contain a PunctureMap which is a map of the objects punctures. It's assumed: - A needle can puncture N different tissues. - A needle can puncture the same tissue multiple times. - A tissue can be punctured by N needles. - A tissue can be punctured multiple times.
Puncture¶
A puncture is defined as having a state REMOVED
, TOUCHING
, or INSERTED
. This holds true for all needles. Though sometimes instant puncture needles are desirable, in which case TOUCHING
would not be used. A puncture also contains a UserData
. This is not used by iMSTK but tends to be useful in user code. It contains the ids of the puncturable, ids of the cell punctured, and barycentric weights. When puncture occurs a Puncture
is added to both the Puncturable
and the Needle
's PunctureMap
. This way each can keep track of what punctures it has. ie: PunctureMap
is not shared, but individual Puncture
's are shared.
NeedleInteraction¶
As mentioned NeedleInteraction
is not yet available in iMSTK but is defined in many iMSTK examples. See PBDTissueVolumeNeedleContact for one such example. Though the internals differ the user facing API is mostly the same.
Suturing¶
Suturing is not yet in iMSTK but has been prototyped in an example.