use of artisynth.core.materials.AxialMuscleMaterial in project artisynth_core by artisynth.
the class Muscle method resetLengthProps.
/**
* sets the opt length to current muscle length and max length with the
* original ratio of opt to max length
*/
public void resetLengthProps() {
if (myMaterial instanceof AxialMuscleMaterial) {
AxialMuscleMaterial mat = (AxialMuscleMaterial) myMaterial;
double length = getLength();
double optLength = mat.getOptLength();
double maxLength = mat.getMaxLength();
double maxOptRatio = (optLength != 0.0) ? maxLength / optLength : 1.0;
mat.setOptLength(length);
mat.setMaxLength(length * maxOptRatio);
} else {
System.err.println("resetLengthProps(), current material not AxialMuscleMaterial");
}
}
use of artisynth.core.materials.AxialMuscleMaterial in project artisynth_core by artisynth.
the class PointSpringBase method setMaxForce.
public static void setMaxForce(PointSpringBase s, double maxf) {
if (s.getMaterial() instanceof AxialMuscleMaterial) {
AxialMuscleMaterial mat = (AxialMuscleMaterial) s.getMaterial().clone();
mat.setMaxForce(maxf);
s.setMaterial(mat);
} else {
System.out.println("Warning: setMaxForce(): no maxForce in spring material");
}
}
use of artisynth.core.materials.AxialMuscleMaterial in project artisynth_core by artisynth.
the class MultiPointMuscle method resetLengthProps.
/**
* sets the opt length to current muscle length and max length with the
* original ratio of opt to max length
*/
public void resetLengthProps() {
if (myMaterial instanceof AxialMuscleMaterial) {
AxialMuscleMaterial mat = (AxialMuscleMaterial) myMaterial;
double length = getLength();
double optLength = mat.getOptLength();
double maxLength = mat.getMaxLength();
double maxOptRatio = (optLength != 0.0) ? maxLength / optLength : 1.0;
mat.setOptLength(length);
mat.setMaxLength(length * maxOptRatio);
} else {
System.err.println("resetLengthProps(), current material not AxialMuscleMaterial");
}
}
use of artisynth.core.materials.AxialMuscleMaterial in project artisynth_core by artisynth.
the class MuscleBundle method setMaxForce.
public void setMaxForce(double maxForce) {
for (int i = 0; i < myFibres.size(); i++) {
Muscle mus = myFibres.get(i);
if (mus.getMaterial() instanceof AxialMuscleMaterial) {
AxialMuscleMaterial mat = (AxialMuscleMaterial) mus.getMaterial().clone();
mat.setMaxForce(maxForce);
mus.setMaterial(mat);
}
}
}
use of artisynth.core.materials.AxialMuscleMaterial in project artisynth_core by artisynth.
the class PointToPointMuscle method getMaxForce.
public double getMaxForce() {
if (numActivations() < 1) {
// no muscle
return 0;
}
MuscleBundle bundle = getMuscleBundles().get(0);
Muscle mus = bundle.getFibres().get(0);
if (mus.getMaterial() instanceof AxialMuscleMaterial) {
return ((AxialMuscleMaterial) mus.getMaterial()).getMaxForce();
} else {
return 0;
}
}
Aggregations