Search in sources :

Example 6 with FemMarker

use of artisynth.core.femmodels.FemMarker in project artisynth_core by artisynth.

the class MFreeModel3d method addMarker.

/**
 * Adds a marker to this FemModel. The element to which it belongs is
 * determined automatically. If the marker's current position does not lie
 * within the model and {@code project == true}, it will be projected onto
 * the model's surface.
 *
 * @param pos
 * position to place a marker in the model
 */
public FemMarker addMarker(Point3d pos) {
    FemMarker mkr = new FemMarker();
    Point3d coord = new Point3d();
    VectorNd N = new VectorNd();
    FemNode3d[] nodes = findNaturalCoordinates(pos, coord, N);
    mkr.setPosition(pos);
    double[] wgts = new double[N.size()];
    for (int i = 0; i < N.size(); ++i) {
        wgts[i] = N.get(i);
    }
    mkr.setFromNodes(nodes, wgts);
    addMarker(mkr);
    return mkr;
}
Also used : Point3d(maspack.matrix.Point3d) IntegrationPoint3d(artisynth.core.femmodels.IntegrationPoint3d) VectorNd(maspack.matrix.VectorNd) FemNode3d(artisynth.core.femmodels.FemNode3d) FemMarker(artisynth.core.femmodels.FemMarker) Point(artisynth.core.mechmodels.Point)

Example 7 with FemMarker

use of artisynth.core.femmodels.FemMarker in project artisynth_core by artisynth.

the class HydrostatModel method createAndAddMarker.

private Point createAndAddMarker(Point3d pnt) {
    numCreatedMarkers++;
    // add the marker to the model
    FemElement3d elem = findContainingElement(pnt);
    if (elem == null) {
        /*
          * project pnt to nearest fem element -- not used b/c of styloglossus
          * System.out.println("containing element null"); Point3d newLoc = new
          * Point3d(); elem = tongue.findNearestElement (newLoc, pnt); pnt.set
          * (newLoc); FemMarker marker = new FemMarker (elem, pnt);
          * tongue.addMarker (marker, elem); return marker;
          */
        FemNode3d fixedNode = new FemNode3d(pnt);
        fixedNode.setDynamic(false);
        addNode(fixedNode);
        return fixedNode;
    } else {
        FemMarker marker = new FemMarker(elem, pnt);
        addMarker(marker, elem);
        return marker;
    }
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d) FemNode3d(artisynth.core.femmodels.FemNode3d) FemMarker(artisynth.core.femmodels.FemMarker)

Aggregations

FemMarker (artisynth.core.femmodels.FemMarker)7 FemNode3d (artisynth.core.femmodels.FemNode3d)4 Point3d (maspack.matrix.Point3d)4 Point (artisynth.core.mechmodels.Point)3 FemElement3d (artisynth.core.femmodels.FemElement3d)2 BlemkerMuscle (artisynth.core.materials.BlemkerMuscle)2 GenericMuscle (artisynth.core.materials.GenericMuscle)2 Muscle (artisynth.core.mechmodels.Muscle)2 Particle (artisynth.core.mechmodels.Particle)2 FemElement (artisynth.core.femmodels.FemElement)1 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 FemNode (artisynth.core.femmodels.FemNode)1 IntegrationPoint3d (artisynth.core.femmodels.IntegrationPoint3d)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 MooneyRivlinMaterial (artisynth.core.materials.MooneyRivlinMaterial)1 SimpleAxialMuscle (artisynth.core.materials.SimpleAxialMuscle)1 AxialSpring (artisynth.core.mechmodels.AxialSpring)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 WayPoint (artisynth.core.probes.WayPoint)1