Search in sources :

Example 1 with MuscleExciter

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

the class FemControlPanel method addExcitersToPanel.

public static void addExcitersToPanel(ControlPanel panel, FemMuscleModel fem) {
    for (MuscleExciter mex : fem.getMuscleExciters()) {
        DoubleFieldSlider slider = (DoubleFieldSlider) panel.addWidget(mex.getName(), fem, "exciters/" + mex.getNumber() + ":excitation", 0, 1);
        slider.setRoundingTolerance(0.00001);
        slider.getLabel().setForeground(FemControlPanel.getMuscleExciterColor(mex.getNumber()));
    }
}
Also used : MuscleExciter(artisynth.core.mechmodels.MuscleExciter) DoubleFieldSlider(maspack.widgets.DoubleFieldSlider)

Example 2 with MuscleExciter

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

the class MuscleExciterEditor method applyAction.

public void applyAction(String actionCommand, LinkedList<ModelComponent> selection, Rectangle popupBounds) {
    if (containsSingleSelection(selection, MuscleExciter.class)) {
        MuscleExciter exciter = (MuscleExciter) selection.get(0);
        if (actionCommand == "Edit targets ...") {
            if (myEditManager.acquireEditLock()) {
                ExcitationTargetAgent agent = new ExcitationTargetAgent(myMain, exciter);
                agent.show(popupBounds);
            }
        }
    }
}
Also used : MuscleExciter(artisynth.core.mechmodels.MuscleExciter)

Example 3 with MuscleExciter

use of artisynth.core.mechmodels.MuscleExciter 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 4 with MuscleExciter

use of artisynth.core.mechmodels.MuscleExciter 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 5 with MuscleExciter

use of artisynth.core.mechmodels.MuscleExciter 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

MuscleExciter (artisynth.core.mechmodels.MuscleExciter)6 ConstantAxialMuscle (artisynth.core.materials.ConstantAxialMuscle)3 Muscle (artisynth.core.mechmodels.Muscle)3 MuscleBundle (artisynth.core.femmodels.MuscleBundle)2 Point3d (maspack.matrix.Point3d)1 DoubleFieldSlider (maspack.widgets.DoubleFieldSlider)1