|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.display.FunctionDrawer
public class FunctionDrawer
FunctionDrawer draws a function from xmin to xmax. The function will be evaluated at every screen pixel unless the domain is set using the initialize method.
Field Summary | |
---|---|
java.awt.Color |
color
|
boolean |
functionChanged
|
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.awt.Color color
public boolean functionChanged
Constructor Detail |
---|
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 trueMethod Detail |
---|
public double evaluate(double x)
evaluate
in interface Function
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)
draw
in interface Drawable
panel
- the drawing panelg
- the graphics contextpublic 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |