Search in sources :

Example 6 with Muscle

use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.

the class HydrostatModel method addTentacleExcitersX.

public void addTentacleExcitersX() {
    for (Axis a : Axis.values()) {
        for (Hemisphere hemi : Hemisphere.values()) {
            MuscleExciter ex = new MuscleExciter(a.getDirName() + "_" + hemi.getName());
            for (Muscle m : muscleFibres) {
                if (Math.abs(m.getDir().dot(a.getDir())) == 1.0 && hemi.check(m.getFirstPoint()) && hemi.check(m.getSecondPoint())) {
                    ex.addTarget(m, 1.0);
                }
            }
            addMuscleExciter(ex);
        // RenderProps.setLineStyle(b, LineStyle.ELLIPSOID);
        // RenderProps.setLineColor(b, PlotTraceInfo.getPaletteColors()[b
        // .getNumber()]);
        }
    }
}
Also used : Muscle(artisynth.core.mechmodels.Muscle) ConstantAxialMuscle(artisynth.core.materials.ConstantAxialMuscle) MuscleExciter(artisynth.core.mechmodels.MuscleExciter)

Example 7 with Muscle

use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.

the class HydrostatModel method createTubeMuscles.

public void createTubeMuscles(TubeAxis axis, MuscleBundle bundle) {
    addMuscleBundle(bundle);
    RenderProps.setLineWidth(bundle, 4);
    RenderProps.setLineColor(bundle, Color.WHITE);
    Point3d p0 = new Point3d();
    Point3d p1 = new Point3d();
    double dl = l / (nl - 1);
    double dt = 2 * Math.PI / nt;
    double dr = (r - rin) / (nr - 1);
    int init_j = (periphLongP && axis == TubeAxis.LONG || periphCircP && axis == TubeAxis.CIRC ? nr - 1 : 0);
    for (double i = 0; i < nt; i++) for (double j = init_j; j < (axis == TubeAxis.RADIAL ? nr - 1 : nr); j++) for (double k = 0; k < (axis == TubeAxis.LONG ? nl - 1 : nl); k++) {
        p0.set(-l / 2 + k * dl, -(rin + dr * j) * Math.cos(dt * i), (rin + dr * j) * Math.sin(dt * i));
        double radius = (rin + dr * (axis == TubeAxis.RADIAL ? j + 1 : j));
        double angle = dt * (axis == TubeAxis.CIRC ? i + 1 : i);
        p1.set(-l / 2 + (axis == TubeAxis.LONG ? k + 1 : k) * dl, -radius * Math.cos(angle), radius * Math.sin(angle));
        Muscle f = new Muscle(findPoint(p0), findPoint(p1));
        f.setConstantMuscleMaterial(muscleForce, 1);
        bundle.addFibre(f);
    }
}
Also used : Point3d(maspack.matrix.Point3d) Muscle(artisynth.core.mechmodels.Muscle) ConstantAxialMuscle(artisynth.core.materials.ConstantAxialMuscle) Point(artisynth.core.mechmodels.Point)

Example 8 with Muscle

use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.

the class HydrostatModel method createExciter.

public void createExciter(String name, Point3d emin, Point3d emax, MuscleBundle b) {
    Point3d pmin = new Point3d();
    Point3d pmax = new Point3d();
    MuscleExciter ex = new MuscleExciter(name);
    addMuscleExciter(ex);
    // great than check -- use minus minimum
    emin.negate();
    for (Muscle f : b.getFibres()) {
        pmin.set(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
        pmax.set(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE);
        f.updateBounds(pmin, pmax);
        // great than check -- use minus minimum
        pmin.negate();
        if (emax.greaterEquals(pmax) && emin.greaterEquals(pmin))
            ex.addTarget(f, 1.0);
    }
}
Also used : Point3d(maspack.matrix.Point3d) Muscle(artisynth.core.mechmodels.Muscle) ConstantAxialMuscle(artisynth.core.materials.ConstantAxialMuscle) MuscleExciter(artisynth.core.mechmodels.MuscleExciter)

Example 9 with Muscle

use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.

the class HydrostatModel method addTentacleMuscles.

/*
    * testing for tentacle simulations
    */
public void addTentacleMuscles() {
    // don't just create peripheral long fibers
    periphLongP = false;
    for (Axis a : Axis.values()) createMuscles(a, a.getDirName());
    for (Axis a : Axis.values()) {
        MuscleBundle b = new MuscleBundle(a.getDirName());
        for (Muscle m : muscleFibres) {
            if (Math.abs(m.getDir().dot(a.getDir()) - 1.0) < 1e-4) {
                // if (m.getName().startsWith(a.getDirName())) {
                b.addFibre(m);
            }
        }
        addMuscleBundle(b);
        RenderProps.setLineStyle(b, Renderer.LineStyle.SPINDLE);
        RenderProps.setLineColor(b, PlotTraceInfo.getPaletteColors()[b.getNumber()]);
    }
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) Muscle(artisynth.core.mechmodels.Muscle) ConstantAxialMuscle(artisynth.core.materials.ConstantAxialMuscle)

Example 10 with Muscle

use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.

the class HydrostatModel method addTentacleExciters.

public void addTentacleExciters() {
    for (Axis a : Axis.values()) {
        MuscleBundle b = myMuscleList.get(a.getDirName());
        for (Hemisphere hemi : Hemisphere.values()) {
            if (Math.abs(hemi.getDir().dot(a.getDir())) == 1.0)
                continue;
            MuscleExciter ex = new MuscleExciter(a.getDirName() + "_" + hemi.getName());
            for (Muscle m : b.getFibres()) {
                if (hemi.check(m.getFirstPoint()) && hemi.check(m.getSecondPoint())) {
                    ex.addTarget(m, 1.0);
                }
            }
            addMuscleExciter(ex);
        }
    }
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) Muscle(artisynth.core.mechmodels.Muscle) ConstantAxialMuscle(artisynth.core.materials.ConstantAxialMuscle) MuscleExciter(artisynth.core.mechmodels.MuscleExciter)

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