Package org.opensourcephysics.display
Class UncertainFunctionDrawer
java.lang.Object
org.opensourcephysics.display.FunctionDrawer
org.opensourcephysics.display.UncertainFunctionDrawer
- All Implemented Interfaces:
Drawable
,Measurable
,Function
When uncertain and unfilled, UncertainFunctionDrawer draws a KnownFunction
with upper and lower limits based on specified parameter uncertainties.
When not uncertain, behaves exactly like FunctionDrawer.
The function is evaluated at every screen pixel.
- Version:
- 1.0
- Author:
- Doug Brown
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AlphaComposite
protected KnownFunction
protected GeneralPath
protected double[]
protected double[]
protected boolean
protected double[][]
protected double[]
protected GeneralPath
Fields inherited from class org.opensourcephysics.display.FunctionDrawer
color, enabled, filled, function, functionChanged, generalPath, measured, numpts, xrange, yrange
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an UncertainFunctionDrawer. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkRange
(DrawingPanel panel) void
Sets all uncertainties to zero.void
draw
(DrawingPanel panel, Graphics g) Draws the function on a drawing panel.double[]
evaluateMinMax
(double x, double[] results) Evaluates the function and determines min/max values by evaluating the function with uncertainParameter sets.void
setUncertain
(boolean uncertain) Sets the uncertain property.void
setUncertainties
(double[][] sigmasAndParams) Sets the uncertainties of all parameters.Methods inherited from class org.opensourcephysics.display.FunctionDrawer
evaluate, getPath, getXMax, getXMin, getXRange, getYMax, getYMin, getYRange, initialize, isMeasured, setColor, setEnabled, setFilled
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Drawable
isInteractive
-
Field Details
-
upperPath
-
lowerPath
-
knownFunction
-
uncertain
protected boolean uncertain -
uncertainties
protected double[] uncertainties -
paramValues
protected double[] paramValues -
uncertainParams
protected double[][] uncertainParams -
multiplier
protected double[] multiplier -
composite
-
-
Constructor Details
-
UncertainFunctionDrawer
Constructs an UncertainFunctionDrawer.- Parameters:
f
- the KnownFunction to draw.
-
-
Method Details
-
evaluateMinMax
public double[] evaluateMinMax(double x, double[] results) Evaluates the function and determines min/max values by evaluating the function with uncertainParameter sets.- Parameters:
x
-results
- double[3] {min, value, max}, may be null- Returns:
- results
-
checkRange
- Overrides:
checkRange
in classFunctionDrawer
-
setUncertain
public void setUncertain(boolean uncertain) Sets the uncertain property.- Parameters:
uncertain
- true to show non-zero uncertainties
-
setUncertainties
public void setUncertainties(double[][] sigmasAndParams) Sets the uncertainties of all parameters.- Parameters:
sigmasAndParams
- array of uncertainties and uncertain limit parameters
-
clearUncertainties
public void clearUncertainties()Sets all uncertainties to zero. -
draw
Draws the function on a drawing panel.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classFunctionDrawer
- Parameters:
panel
- the drawing panelg
- the graphics context
-