Just as there are FrameMarkers to act as anchor points on a frame or rigid body (Section 3.2.1), there are also FemMarkers that can mark a point inside a finite element. They are frequently used to provide anchor points for attaching springs and forces to a point inside an element, but can also be used for graphical purposes.
FEM markers are implemented by the class FemMarker, which is a subclass of Point. They are essentially massless points that contain their own attachment component, so when creating and adding a marker there is no need to create a separate attachment component.
Within the component hierarchy, FEM markers are typically stored in the markers list of their associated FEM model. They can be created and added using a code fragment of the form
This creates a marker at the location (in world coordinates), calls setFromFem() to attach it to the nearest element in the FEM model ( which is either the containing element or the nearest element on the model’s surface), and then adds it to the markers list.
If the marker’s attachment has not already been set when addMarker() is called, then addMarker() will call setFromFem() automatically. Therefore the above code fragment is equivalent to the following:
Alternatively, one may want to explicitly specify the nodes associated with the attachment, as described in Section 6.4.8:
There are a variety of methods available to set the attachment, mirroring those available in the underlying base class PointFem3dAttachment:
The last two methods compute nodal weights automatically, as described in Section 6.4.8, based on the marker’s currently assigned position. If the supplied nodes do not provide sufficient support, then the methods return false.
Another set of convenience methods are supplied by FemModel3d, which combine these with the addMarker() call:
For example, one can do
Markers are often used to track movement within an FEM model. For that, one can examine their positions and velocities, as with any other particles, using the methods
The return values from these methods should not be modified. Alternatively, when a 3D force is applied to the marker, it is distributed to the attached nodes according to the nodal weights, as described in Equation (6.3).
A complete application model that employs a fem marker as an anchor for a spring is given below.
This example can be found in artisynth.demos.tutorial.FemBeamWithMuscle. This model extends the FemBeam example, adding a FemMarker for the spring to attach to. The method createMarker(...) on lines 29–35 is used to create and add a marker to the FEM. Since the element is initially set to null, when it is added to the FEM, the model searches for the containing or nearest element. The loaded model is shown in Figure 6.11.