public class ParametricCurve extends Drawable implements Computable
Constructor and Description |
---|
ParametricCurve()
Create a ParametricCurve with nothing to graph.
|
ParametricCurve(Function xFunc,
Function yFunc)
Create a parametric curve with x and y coordinates given by the specified functions
of the parameter t.
|
ParametricCurve(Function xFunc,
Function yFunc,
Value tmin,
Value tmax,
Value intevals)
Create a parametric curve with the specified values.
|
Modifier and Type | Method and Description |
---|---|
void |
compute()
Recompute data for the graph and make sure that the area of the display canvas
that shows the graph is redrawn.
|
void |
draw(Graphics g,
boolean coordsChanged)
Draw the graph (possibly recomputing the data if the CoordinateRect has changed).
|
Color |
getColor()
Get the color that is used to draw the graph.
|
Value |
getIntervals()
Get the value object, possibly null, that determines the number of points on the curve.
|
Value |
getTMax()
Get the Value object, possibly null, that gives the right endpoint of the domain of the parameter.
|
Value |
getTMin()
Get the Value object, possibly null, that gives the left endpoint of the domain of the parameter.
|
Function |
getXFunction()
Get the (possibly null) function that gives the x-coordinate of the curve.
|
Function |
getYFunction()
Get the (possibly null) function that gives the y-coordinate of the curve.
|
void |
setColor(Color c)
Set the color to be used for drawing the graph.
|
void |
setFunctions(Function x,
Function y)
Sets the functions that gives the coordinates of the curve to be graphed.
|
void |
setIntervals(Value intervalCount)
Specify the number of subintervals into which the domain of the parametric curve is divided.
|
void |
setLimits(Value tmin,
Value tmax)
Set the Value objects that specify the domain of the paratmeter.
|
void |
setTMax(Value tmax)
Set the Value object that gives the right endpoint of the domain of the parameter.
|
void |
setTMin(Value tmin)
Set the Value object that gives the left endpoint of the domain of the parameter.
|
void |
setXFunction(Function x)
Set the function that gives the x-coordinate of the curve to be graphed.
|
void |
setYFunction(Function y)
Set the function that gives the y-coordinate of the curve to be graphed.
|
getVisible, needsRedraw, setOwnerData, setVisible
public ParametricCurve()
public ParametricCurve(Function xFunc, Function yFunc)
public ParametricCurve(Function xFunc, Function yFunc, Value tmin, Value tmax, Value intevals)
xFunc
- A Function of one variable giving the x-coordinate of points on the curve. If this
is null, then nothing will be drawn.yFunc
- A Function of one variable giving the y-coordinate of points on the curve. If this
is null, then nothing will be drawn.tmin
- A Value object giving one endpoint of the domain of the parameter. If this is null,
the default value -5 is used.tmax
- A Value object giving the second endpoint of the domain of the parameter. If this is null,
the default value 5 is used. Note that it is not required that tmax be greater than tmin.intervals
- A Value object giving the number of intervals into which the domain is subdivided.
If this is null, the default value 200 is used. The number of points on the curve will be
the number of intervals plus one (unless a function is undefined at some value of the parameter
or if a discontinuity is detected). The number of intervals is clamped to the range 1 to 10000.
Values outside this range would certainly be unreasonable.public void setColor(Color c)
public Color getColor()
public void setFunctions(Function x, Function y)
public void setXFunction(Function x)
public void setYFunction(Function y)
public Function getXFunction()
public Function getYFunction()
public void setIntervals(Value intervalCount)
public Value getIntervals()
public void setLimits(Value tmin, Value tmax)
public Value getTMin()
public Value getTMax()
public void setTMin(Value tmin)
public void setTMax(Value tmax)
public void compute()
compute
in interface Computable
public void draw(Graphics g, boolean coordsChanged)
draw
in class Drawable
g
- The graphics context in which the Drawble is to be drawn. (The drawing
can change the color in g, but should not permanently change font, painting mode, etc.
Thus, every drawable is responsible for setting the color it wants to use.)coordsChanged
- Indicates whether the CoordinateRect has changed.