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()));
}
}
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);
}
}
}
}
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()]);
}
}
}
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);
}
}
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);
}
}
}
Aggregations