Search in sources :

Example 16 with DoubleInterval

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);
}
Also used : DoubleInterval(maspack.util.DoubleInterval) Point(artisynth.core.mechmodels.Point)

Example 17 with DoubleInterval

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);
}
Also used : DoubleInterval(maspack.util.DoubleInterval)

Example 18 with DoubleInterval

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);
}
Also used : DoubleInterval(maspack.util.DoubleInterval) InternalErrorException(maspack.util.InternalErrorException) CompositeProperty(maspack.properties.CompositeProperty) EditingProperty(maspack.properties.EditingProperty) Property(maspack.properties.Property)

Example 19 with DoubleInterval

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;
}
Also used : DoubleInterval(maspack.util.DoubleInterval) NumericInterval(maspack.util.NumericInterval)

Example 20 with DoubleInterval

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);
}
Also used : DoubleInterval(maspack.util.DoubleInterval)

Aggregations

DoubleInterval (maspack.util.DoubleInterval)22 NumericInterval (maspack.util.NumericInterval)3 Property (maspack.properties.Property)2 IntegerInterval (maspack.util.IntegerInterval)2 BooleanSelector (maspack.widgets.BooleanSelector)2 DoubleIntervalField (maspack.widgets.DoubleIntervalField)2 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)1 PropertyField (artisynth.core.gui.widgets.PropertyField)1 Point (artisynth.core.mechmodels.Point)1 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)1 NumericProbeVariable (artisynth.core.probes.NumericProbeVariable)1 ColorBar (artisynth.core.renderables.ColorBar)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 Font (java.awt.Font)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 BoxLayout (javax.swing.BoxLayout)1