use of artisynth.core.femmodels.FemElement3d in project artisynth_core by artisynth.
the class MFreeMuscleModel method render.
// public void setDrawFibers(boolean enable) {
// myDrawFibers = enable;
// }
public void render(Renderer renderer, int flags) {
super.render(renderer, flags);
// if (myFiberMesh != null) {
// myFiberMesh.render(renderer, myRenderProps, /* flags= */0);
// }
// if (myDrawFibers) {
RenderProps fiberRenderProps = myFiberRenderProps;
if (fiberRenderProps == null) {
fiberRenderProps = DEFAULT_FIBER_RENDER_PROPS;
}
double dirLen = getDirectionRenderLen();
if (dirLen > 0) {
Matrix3d F = new Matrix3d();
Vector3d dir = new Vector3d();
float[] coords0 = new float[3];
float[] coords1 = new float[3];
for (FemElement3d e : getElements()) {
renderDirection(renderer, fiberRenderProps, e, coords0, coords1, F, dir, dirLen);
}
}
}
use of artisynth.core.femmodels.FemElement3d in project artisynth_core by artisynth.
the class MFreeNode3d method computeMassFromDensity.
public double computeMassFromDensity() {
double mass = 0;
Iterator<FemElement3d> it = getElementDependencies().iterator();
while (it.hasNext()) {
FemElement3d e = it.next();
mass += e.getRestVolume() * e.getDensity() / e.numNodes();
}
return mass;
}
use of artisynth.core.femmodels.FemElement3d in project artisynth_core by artisynth.
the class FemSurfaceTargetDemo method addMuscle.
public void addMuscle(String name, Color color, Vector3d dir) {
MuscleBundle b = new MuscleBundle(name);
for (FemElement3d e : fem.getElements()) {
b.addElement(e, dir);
}
b.setMuscleMaterial(new SimpleForceMuscle(muscleMaxStress));
b.setDirectionRenderLen(w / 4);
RenderProps.setLineColor(b, color);
RenderProps.setLineWidth(b, 4);
fem.addMuscleBundle(b);
}
use of artisynth.core.femmodels.FemElement3d in project artisynth_core by artisynth.
the class FemMuscleDemo method createBundle.
protected MuscleBundle createBundle(String name, List<FemElement3d> elems) {
MuscleBundle bundle = new MuscleBundle(name);
if (elems != null) {
for (FemElement3d e : elems) {
MuscleElementDesc desc = new MuscleElementDesc();
desc.setElement(e);
desc.setDirection(Vector3d.X_UNIT);
bundle.addElement(desc);
}
}
return bundle;
}
use of artisynth.core.femmodels.FemElement3d 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