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;
}
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;
}
}
Aggregations