Class UncertainFunctionDrawer

java.lang.Object
org.opensourcephysics.display.FunctionDrawer
org.opensourcephysics.display.UncertainFunctionDrawer
All Implemented Interfaces:
Drawable, Measurable, Function

public class UncertainFunctionDrawer extends FunctionDrawer
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 Details

    • upperPath

      protected GeneralPath upperPath
    • lowerPath

      protected GeneralPath lowerPath
    • knownFunction

      protected KnownFunction knownFunction
    • uncertain

      protected boolean uncertain
    • uncertainties

      protected double[] uncertainties
    • paramValues

      protected double[] paramValues
    • uncertainParams

      protected double[][] uncertainParams
    • multiplier

      protected double[] multiplier
    • composite

      protected AlphaComposite composite
  • Constructor Details

    • UncertainFunctionDrawer

      public UncertainFunctionDrawer(KnownFunction f)
      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

      protected void checkRange(DrawingPanel panel)
      Overrides:
      checkRange in class FunctionDrawer
    • 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

      public void draw(DrawingPanel panel, Graphics g)
      Draws the function on a drawing panel.
      Specified by:
      draw in interface Drawable
      Overrides:
      draw in class FunctionDrawer
      Parameters:
      panel - the drawing panel
      g - the graphics context