Class ParametrisedCanvas

All Implemented Interfaces:
ComponentListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class ParametrisedCanvas extends AbstractCanvas
This class plots parametrised curves specified by two Jep expressions.
See Also:
  • Field Details

    • jep

      protected final Jep jep
      Math parser
    • xExpression

      protected Node xExpression
      Expression to evaluate
    • yExpression

      protected Node yExpression
    • t

      protected Variable t
      "x" variable
  • Constructor Details

    • ParametrisedCanvas

      public ParametrisedCanvas(Jep jep, Variable t, double min, double max, int steps)
      Parameters:
      jep - The Jep instance
      t - A Variable object holding the parameter
      min - minimum value for parameter
      max - maximum value for parameter
      steps - number of line segments to draw
  • Method Details

    • getT

      public Variable getT()
    • setT

      public void setT(Variable t)
    • getXExpression

      public Node getXExpression()
    • getYExpression

      public Node getYExpression()
    • setXExpression

      public void setXExpression(Node xExpr)
    • setYExpression

      public void setYExpression(Node yExpr)
    • getTMin

      public double getTMin()
    • getTMax

      public double getTMax()
    • getTSteps

      public int getTSteps()
    • setRange

      public void setRange(double min, double max, int steps)
    • getYValue

      protected double getYValue(double tValue)
      Returns:
      The value of the function at an x value of the parameter. NaN on errors
    • getXValue

      protected double getXValue(double tValue)
    • paintCurve

      protected void paintCurve(Graphics g)
      Paints the graph of the function. A null argument cause the values to be dumped to stdout.
      Specified by:
      paintCurve in class AbstractCanvas
    • rescaled

      public void rescaled()
      Description copied from class: AbstractCanvas
      Called when scale or offset changed Default action is to call repaint
      Overrides:
      rescaled in class AbstractCanvas
    • dump

      public void dump()
      Dump the coordinates on the standard output
      Specified by:
      dump in class AbstractCanvas
    • getNumPts

      protected long getNumPts()
      Description copied from class: AbstractCanvas
      The number of points which are calculated
      Specified by:
      getNumPts in class AbstractCanvas
      Returns:
      the number of points