Search in sources :

Example 1 with AxialMuscleMaterial

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");
    }
}
Also used : AxialMuscleMaterial(artisynth.core.materials.AxialMuscleMaterial)

Example 2 with 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");
    }
}
Also used : AxialMuscleMaterial(artisynth.core.materials.AxialMuscleMaterial)

Example 3 with AxialMuscleMaterial

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");
    }
}
Also used : AxialMuscleMaterial(artisynth.core.materials.AxialMuscleMaterial)

Example 4 with 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);
        }
    }
}
Also used : AxialMuscleMaterial(artisynth.core.materials.AxialMuscleMaterial) Muscle(artisynth.core.mechmodels.Muscle) GenericMuscle(artisynth.core.materials.GenericMuscle) Point(artisynth.core.mechmodels.Point)

Example 5 with AxialMuscleMaterial

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;
    }
}
Also used : AxialMuscleMaterial(artisynth.core.materials.AxialMuscleMaterial) Muscle(artisynth.core.mechmodels.Muscle)

Aggregations

AxialMuscleMaterial (artisynth.core.materials.AxialMuscleMaterial)6 Muscle (artisynth.core.mechmodels.Muscle)2 GenericMuscle (artisynth.core.materials.GenericMuscle)1 LinearAxialMaterial (artisynth.core.materials.LinearAxialMaterial)1 Point (artisynth.core.mechmodels.Point)1