use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class MuscleBundle method getFibreRestDirections.
public Vector3d[] getFibreRestDirections() {
if (myFibres.size() == 0) {
return null;
}
Point3d pos1 = new Point3d();
Point3d pos2 = new Point3d();
Vector3d dir = new Vector3d();
Vector3d[] muscleDirs = new Vector3d[myFibres.size()];
for (int i = 0; i < myFibres.size(); i++) {
Muscle fibre = myFibres.get(i);
getRestPosition(pos1, fibre.getFirstPoint());
getRestPosition(pos2, fibre.getSecondPoint());
dir.sub(pos2, pos1);
dir.normalize();
muscleDirs[i] = new Vector3d(dir);
}
return muscleDirs;
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class MuscleBundle method getFibreRestDistanceInterpolator.
public DelaunayInterpolator getFibreRestDistanceInterpolator() {
if (myFibres.size() == 0) {
return null;
}
Point3d pos1 = new Point3d();
Point3d pos2 = new Point3d();
Point3d loc = new Point3d();
Point3d[] muscleLocs = new Point3d[myFibres.size()];
for (int i = 0; i < myFibres.size(); i++) {
Muscle fibre = myFibres.get(i);
getRestPosition(pos1, fibre.getFirstPoint());
getRestPosition(pos2, fibre.getSecondPoint());
loc.add(pos2, pos1);
loc.scale(1 / 2.0);
muscleLocs[i] = new Point3d(loc);
}
DelaunayInterpolator interpolator = new DelaunayInterpolator();
interpolator.setPoints(muscleLocs);
return interpolator;
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class MuscleBundle method getDefaultActivationWeight.
/**
* {@inheritDoc}
*
* For muscle tissue we are using the average max force (proportional to
* physiological cross-sectional area) for all fibers within the bundle.
* Note: we could also use spatial distribution of fibres to determine CSA
* instead.
*/
public double getDefaultActivationWeight() {
AxialSpringList<Muscle> fibres = getFibres();
double averageMaxForce = 0;
for (int j = 0; j < fibres.size(); j++) {
averageMaxForce += Muscle.getMaxForce(fibres.get(j));
}
return averageMaxForce / fibres.size();
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class PointToPointMuscle method addStrand.
private void addStrand(MuscleBundle bundle, int[] strand) {
for (int s = 4; s < strand.length - 3; s++) {
Muscle fibre = new Muscle();
fibre.setConstantMuscleMaterial(1, 1);
fibre.setFirstPoint(getNode(strand[s - 1]));
fibre.setSecondPoint(getNode(strand[s]));
bundle.addFibre(fibre);
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class FemMuscleDemo method addStrand.
/**
* Adds a strand of muscles interpolated between two points, using FemNodes
* if they are close enough, or otherwise inserting markers.
*/
protected void addStrand(MuscleBundle bundle, double p0x, double p0y, double p0z, double p1x, double p1y, double p1z, double quadTerm, int numPnts) {
Point pnt;
Point prevPnt = null;
Point3d pos0 = new Point3d(p0x, p0y, p0z);
Point3d pos1 = new Point3d(p1x, p1y, p1z);
Point3d pos = new Point3d();
for (int i = 0; i < numPnts; i++) {
double s = i / (numPnts - 1.0);
pos.combine(1 - s, pos0, s, pos1);
double r = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
pos.z += quadTerm * r * r;
pnt = findNearestNode(pos);
if (pnt.distance(pos) > 0.0001) {
FemMarker mkr = new FemMarker(pos);
tissue.addMarker(mkr);
pnt = mkr;
}
if (prevPnt != null) {
Muscle muscle = new Muscle();
muscle.setConstantMuscleMaterial(1, 1);
muscle.setFirstPoint(prevPnt);
muscle.setSecondPoint(pnt);
bundle.addFibre(muscle);
}
prevPnt = pnt;
}
}
Aggregations