public class FunctionDrawer extends java.lang.Object implements Drawable, Measurable, Function
Modifier and Type | Field and Description |
---|---|
java.awt.Color |
color |
boolean |
functionChanged |
Constructor and Description |
---|
FunctionDrawer(Function f)
Contstucts a FunctionDrawer with optimum resolution.
|
FunctionDrawer(Function f,
double xmin,
double xmax,
int numpts,
boolean filled)
Creates the function drawer and initialzies the domain with the given values.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draw the function on a drawing panel.
|
double |
evaluate(double x)
Evalutes the function.
|
java.awt.geom.GeneralPath |
getPath()
Gets the general path that draws this function.
|
double |
getXMax()
Gets the maximum x needed to draw this object.
|
double |
getXMin()
Gets the minimum x needed to draw this object.
|
double[] |
getXRange()
Get the range of x values over which the function has been evaluated.
|
double |
getYMax()
Gets the maximum y needed to draw this object.
|
double |
getYMin()
Gets the minimum y needed to draw this object.
|
double[] |
getYRange()
Get the minimum and maximum y values for the function.
|
void |
initialize(double xmin,
double xmax,
int numpts,
boolean filled)
Initialize the function range and the number of display points.
|
boolean |
isMeasured()
Determines if information is available to set min/max values.
|
void |
setColor(java.awt.Color c)
Sets the drawing color.
|
void |
setFilled(boolean _filled)
Fills the area under the curve when true.
|
public FunctionDrawer(Function f)
f
- the function that will be drawn.public FunctionDrawer(Function f, double xmin, double xmax, int numpts, boolean filled)
f
- Functionxmin
- doublexmax
- doublenumpts
- intfilled
- boolean fills the area under the curve with the drawing color when truepublic double evaluate(double x)
public void initialize(double xmin, double xmax, int numpts, boolean filled)
xmin
- the beginning value of the range.xmax
- the ending value for the rangenumpts
- the number of points to displayfilled
- fills the area under the curve with the drawing color when truepublic java.awt.geom.GeneralPath getPath()
public double[] getXRange()
public double[] getYRange()
public void draw(DrawingPanel panel, java.awt.Graphics g)
public void setFilled(boolean _filled)
_filled
- booleanpublic void setColor(java.awt.Color c)
c
- Colorpublic boolean isMeasured()
Measurable
isMeasured
in interface Measurable
public double getXMin()
Measurable
getXMin
in interface Measurable
public double getXMax()
Measurable
getXMax
in interface Measurable
public double getYMin()
Measurable
getYMin
in interface Measurable
public double getYMax()
Measurable
getYMax
in interface Measurable