use of maspack.util.DoubleInterval in project artisynth_core by artisynth.
the class FemModel3d method getNodalPlotRange.
public DoubleInterval getNodalPlotRange(SurfaceRender rendering) {
if (!(rendering == SurfaceRender.Strain || rendering == SurfaceRender.Stress)) {
return null;
}
double min = Double.MAX_VALUE;
double max = 0;
for (int i = 0; i < myNodes.size(); i++) {
FemNode3d node = myNodes.get(i);
double s;
if (rendering == SurfaceRender.Stress) {
s = (float) node.getVonMisesStress();
} else {
s = (float) node.getVonMisesStrain();
}
if (s < min) {
min = s;
}
if (s > max) {
max = s;
}
}
return new DoubleInterval(min, max);
}
use of maspack.util.DoubleInterval in project artisynth_core by artisynth.
the class FemModel method setStressPlotRange.
public void setStressPlotRange(DoubleInterval range) {
myStressPlotRange = new DoubleInterval(range);
myStressPlotRangeMode = PropertyUtils.propagateValue(this, "stressPlotRange", range, myStressPlotRangeMode);
}
use of maspack.util.DoubleInterval in project artisynth_core by artisynth.
the class PropertyWidgetDialog method updateRange.
private void updateRange(ModelComponent comp, PropertyInfo info) {
Property prop = comp.getProperty(info.getName());
if (prop == null) {
throw new InternalErrorException("Cannot create property '" + info.getName() + " for component type " + comp.getClass());
}
DoubleInterval newRange = getDefaultRange(prop);
double currentValue = ((Number) prop.get()).doubleValue();
if (currentValue < newRange.getLowerBound()) {
newRange.setLowerBound(currentValue);
} else if (currentValue > newRange.getUpperBound()) {
newRange.setUpperBound(currentValue);
}
myRangeField.setValue(newRange);
}
use of maspack.util.DoubleInterval in project artisynth_core by artisynth.
the class PropertyWidgetDialog method getDefaultRange.
private DoubleInterval getDefaultRange(Property prop) {
DoubleInterval range = myRangeMap.get(prop.getInfo());
if (range == null) {
NumericInterval nrange = PropertyWidget.getNumericRange(prop);
if (nrange != null) {
range = new DoubleInterval(nrange);
} else {
range = new DoubleInterval(0, 1);
}
myRangeMap.put(prop.getInfo(), range);
}
return range;
}
use of maspack.util.DoubleInterval in project artisynth_core by artisynth.
the class NumericProbeDisplayLarge method actionPerformed.
public void actionPerformed(ActionEvent e) {
String nameOfAction = e.getActionCommand();
yRangeField.removeValueChangeListener(this);
xRangeField.removeValueChangeListener(this);
if (nameOfAction == "Zoom In") {
setDisplayAction(zoomInBtn);
myPanel.toggleZoomIn();
} else if (nameOfAction == "Zoom Out") {
setDisplayAction(zoomOutBtn);
myPanel.toggleZoomOut();
} else if (nameOfAction == "Move Display") {
setDisplayAction(moveDisplayBtn);
myPanel.toggleMoveDisplay();
} else if (nameOfAction == "Edit Plot") {
myPanel.zoomIn = false;
myPanel.zoomOut = false;
myPanel.moveDisplay = false;
setDisplayAction(pointerBtn);
} else if (nameOfAction == "Fit Range") {
myProbe.applyDefaultDisplayRanges();
} else if (nameOfAction == "Increase Range") {
myProbe.increaseDisplayRanges();
myProbe.updateDisplays();
} else if (nameOfAction == "Decrease Range") {
myProbe.decreaseDisplayRanges();
myProbe.updateDisplays();
}
setYRange(myPanel.getDisplayRange());
setXRange(myPanel.getDisplayDomain());
yRangeField.setValue(new DoubleInterval(yMin, yMax));
xRangeField.setValue(new DoubleInterval(xMin, xMax));
yRangeField.addValueChangeListener(this);
xRangeField.addValueChangeListener(this);
}
Aggregations