use of maspack.widgets.DoubleFieldSlider 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 maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.
the class FemControlPanel method addBundlesToPanel.
public static void addBundlesToPanel(ControlPanel panel, FemMuscleModel fem, boolean reColor) {
int ncolors = PlotTraceInfo.numPalatteColors();
ComponentList<MuscleBundle> bundles = fem.getMuscleBundles();
for (int i = 0; i < bundles.size(); ++i) {
MuscleBundle bundle = bundles.get(i);
DoubleFieldSlider slider = (DoubleFieldSlider) panel.addWidget(bundle.getName(), fem, "bundles/" + bundle.getNumber() + ":excitation", 0, 1);
if (slider == null)
continue;
slider.setRoundingTolerance(0.00001);
if (reColor) {
slider.getLabel().setForeground(PlotTraceInfo.getPaletteColors()[i % ncolors]);
RenderProps.setLineColor(bundles.get(i), PlotTraceInfo.getPaletteColors()[i % ncolors]);
RenderProps.setFaceColor(bundles.get(i), PlotTraceInfo.getPaletteColors()[i % ncolors]);
} else {
if (bundles.get(i).getRenderProps() != null) {
slider.getLabel().setForeground(bundles.get(i).getRenderProps().getLineColor());
}
}
}
}
use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.
the class FemMuscleDemo method createMusclePanel.
public void createMusclePanel() {
ControlPanel myControlPanel = new ControlPanel("options", "LiveUpdate");
FemControlPanel.addMuscleControls(myControlPanel, tissue, myModel);
myControlPanel.addWidget(tissue, "profile");
ComponentList<MuscleBundle> muscles = ((FemMuscleModel) tissue).getMuscleBundles();
for (int i = 0; i < muscles.size(); ++i) {
DoubleFieldSlider slider = (DoubleFieldSlider) myControlPanel.addWidget("activation [N per Muscle]", this, "models/FemBeam/models/fem/bundles/" + i + ":excitation", 0, 1);
slider.setRoundingTolerance(0.00001);
slider.getLabel().setForeground(getMuscleColor(i));
BooleanSelector checkBox = (BooleanSelector) PropertyWidget.create("", muscles.get(i), "renderProps.visible");
checkBox.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent e) {
rerender();
}
});
slider.add(checkBox);
}
for (int i = 0; i < muscles.size(); ++i) {
BooleanSelector selector = (BooleanSelector) myControlPanel.addWidget("fibres active", this, "models/FemBeam/models/fem/bundles/" + i + ":fibresActive");
selector.getLabel().setForeground(getMuscleColor(i));
BooleanSelector checkBox = (BooleanSelector) PropertyWidget.create("", muscles.get(i).getFibres(), "renderProps.visible");
checkBox.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent e) {
rerender();
}
});
selector.add(checkBox);
}
addControlPanel(myControlPanel);
}
use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.
the class TubeDemo method addControlPanel.
protected void addControlPanel() {
// MechModel mechMod, FemModel3d femMod) {
ControlPanel myControlPanel = new ControlPanel("options", "");
DoubleFieldSlider ymSlider = (DoubleFieldSlider) myControlPanel.addWidget(this, "youngsModulus", 1000, 1600000);
ymSlider.setRoundingTolerance(10000);
myControlPanel.addWidget(this, "poissonsRatio", -1, 0.5);
// myControlPanel.addWidget (mod, "density", 100, 5000);
// myControlPanel.addWidget (mod, "particleDamping", 0, 200);
// myControlPanel.addWidget (mod, "stiffnessDamping", 0, 1);
// myControlPanel.addWidget (mod, "integrator");
// myControlPanel.addWidget (mod, "matrixSolver");
// myControlPanel.addWidget (mod, "maxStepSize");
myControlPanel.addWidget(this, "warping");
myControlPanel.addWidget(this, "amplitude");
myControlPanel.addWidget(this, "frequency");
addControlPanel(myControlPanel);
}
use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.
the class SpongeDemo method addControls.
protected void addControls(ControlPanel panel) {
FemControlPanel.addMuscleControls(panel, sponge, sponge);
panel.addWidget(sponge, "profile");
if (sponge.getMuscleBundles().size() > 0) {
ComponentList<MuscleBundle> muscles = ((SpongeModel) sponge).getMuscleBundles();
for (int i = 0; i < muscles.size(); ++i) {
// sponge.getMuscleList().get(i).setName(String.valueOf(i));
DoubleFieldSlider slider = (DoubleFieldSlider) panel.addWidget("excitation [N]", sponge, "bundles/" + i + ":excitation", 0, 1);
slider.setRoundingTolerance(0.001);
int idx = i % NumericProbePanel.colorList.length;
slider.getLabel().setForeground(NumericProbePanel.colorList[idx]);
}
}
panel.addWidget(new JSeparator());
panel.addWidget("gang 0-2", sponge, "exciters/gang:excitation");
panel.addWidget("all muscles", sponge, "exciters/all:excitation");
}
Aggregations