Search in sources :

Example 1 with Muscle

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;
}
Also used : Vector3d(maspack.matrix.Vector3d) Point3d(maspack.matrix.Point3d) Muscle(artisynth.core.mechmodels.Muscle) GenericMuscle(artisynth.core.materials.GenericMuscle) Point(artisynth.core.mechmodels.Point)

Example 2 with Muscle

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;
}
Also used : Point3d(maspack.matrix.Point3d) Muscle(artisynth.core.mechmodels.Muscle) GenericMuscle(artisynth.core.materials.GenericMuscle) DelaunayInterpolator(maspack.geometry.DelaunayInterpolator) Point(artisynth.core.mechmodels.Point)

Example 3 with Muscle

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

Example 4 with Muscle

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

Example 5 with Muscle

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;
    }
}
Also used : Point3d(maspack.matrix.Point3d) BlemkerMuscle(artisynth.core.materials.BlemkerMuscle) Muscle(artisynth.core.mechmodels.Muscle) GenericMuscle(artisynth.core.materials.GenericMuscle) Point(artisynth.core.mechmodels.Point) FemMarker(artisynth.core.femmodels.FemMarker) Point(artisynth.core.mechmodels.Point)

Aggregations

Muscle (artisynth.core.mechmodels.Muscle)35 Point3d (maspack.matrix.Point3d)13 Point (artisynth.core.mechmodels.Point)10 ConstantAxialMuscle (artisynth.core.materials.ConstantAxialMuscle)9 AxialSpring (artisynth.core.mechmodels.AxialSpring)8 GenericMuscle (artisynth.core.materials.GenericMuscle)7 MuscleBundle (artisynth.core.femmodels.MuscleBundle)6 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)5 SimpleAxialMuscle (artisynth.core.materials.SimpleAxialMuscle)4 Particle (artisynth.core.mechmodels.Particle)4 RenderProps (maspack.render.RenderProps)4 FrameMarker (artisynth.core.mechmodels.FrameMarker)3 MuscleExciter (artisynth.core.mechmodels.MuscleExciter)3 Vector3d (maspack.matrix.Vector3d)3 FemMarker (artisynth.core.femmodels.FemMarker)2 ForceTarget (artisynth.core.inverse.ForceTarget)2 ForceTargetTerm (artisynth.core.inverse.ForceTargetTerm)2 TrackingController (artisynth.core.inverse.TrackingController)2 AxialMuscleMaterial (artisynth.core.materials.AxialMuscleMaterial)2 RigidBody (artisynth.core.mechmodels.RigidBody)2