| java.lang.Object edu.hws.jcm.draw.Drawable edu.hws.jcm.draw.ParametricCurve
ParametricCurve | public class ParametricCurve extends Drawable implements Computable(Code) | | A ParametricCurve is defined by two functions, x(t) and y(t) of a variable, t,
for t in a specified interval. The curve is simply defined as a sequence of line
segments connecting points of the form (x(t),y(t)), except where one of the functions
is undefined. Also, in some cases a
discontinuity will be detected and no line will be drawn between two of the points.
|
Constructor Summary | |
public | ParametricCurve() Create a ParametricCurve with nothing to graph. | public | ParametricCurve(Function xFunc, Function yFunc) Create a parametric curve with x and y coordinates given by the specified functions
of the parameter t. | public | ParametricCurve(Function xFunc, Function yFunc, Value tmin, Value tmax, Value intevals) Create a parametric curve with the specified values.
Parameters: xFunc - A Function of one variable giving the x-coordinate of points on the curve. |
Method Summary | |
void | becomesDefined(Point p1, double t1, Point p2, double t2, int depth) | void | becomesUndefined(Point p1, double t1, Point p2, double t2, int depth) | public synchronized void | compute() Recompute data for the graph and make sure that the area of the display canvas
that shows the graph is redrawn. | void | discontinuity(Point p1, double t1, Point p2, double t2, int depth) | public synchronized void | draw(Graphics g, boolean coordsChanged) Draw the graph (possibly recomputing the data if the CoordinateRect has changed). | public Color | getColor() Get the color that is used to draw the graph. | public Value | getIntervals() Get the value object, possibly null, that determines the number of points on the curve. | public Value | getTMax() Get the Value object, possibly null, that gives the right endpoint of the domain of the parameter. | public Value | getTMin() Get the Value object, possibly null, that gives the left endpoint of the domain of the parameter. | public Function | getXFunction() Get the (possibly null) function that gives the x-coordinate of the curve. | public Function | getYFunction() Get the (possibly null) function that gives the y-coordinate of the curve. | public void | setColor(Color c) Set the color to be used for drawing the graph. | public synchronized void | setFunctions(Function x, Function y) Sets the functions that gives the coordinates of the curve to be graphed. | public void | setIntervals(Value intervalCount) Specify the number of subintervals into which the domain of the parametric curve is divided.
The interval (tmin,tmax) is divided into subintervals. | public void | setLimits(Value tmin, Value tmax) Set the Value objects that specify the domain of the paratmeter. | public void | setTMax(Value tmax) Set the Value object that gives the right endpoint of the domain of the parameter. | public void | setTMin(Value tmin) Set the Value object that gives the left endpoint of the domain of the parameter. | public synchronized void | setXFunction(Function x) Set the function that gives the x-coordinate of the curve to be graphed. | public synchronized void | setYFunction(Function y) Set the function that gives the y-coordinate of the curve to be graphed. |
ParametricCurve | public ParametricCurve()(Code) | | Create a ParametricCurve with nothing to graph. The functions and other values
can be set later.
|
ParametricCurve | public ParametricCurve(Function xFunc, Function yFunc)(Code) | | Create a parametric curve with x and y coordinates given by the specified functions
of the parameter t. Defaults values are used for tmin, tmax, and the number of intervals.
If either function is null, nothing is drawn.
|
ParametricCurve | public ParametricCurve(Function xFunc, Function yFunc, Value tmin, Value tmax, Value intevals)(Code) | | Create a parametric curve with the specified values.
Parameters: xFunc - A Function of one variable giving the x-coordinate of points on the curve. If thisis null, then nothing will be drawn. Parameters: yFunc - A Function of one variable giving the y-coordinate of points on the curve. If thisis null, then nothing will be drawn. Parameters: tmin - A Value object giving one endpoint of the domain of the parameter. If this is null,the default value -5 is used. Parameters: 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. Parameters: 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 bethe number of intervals plus one (unless a function is undefined at some value of the parameteror 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. |
becomesDefined | void becomesDefined(Point p1, double t1, Point p2, double t2, int depth)(Code) | | |
becomesUndefined | void becomesUndefined(Point p1, double t1, Point p2, double t2, int depth)(Code) | | |
compute | public synchronized void compute()(Code) | | Recompute data for the graph and make sure that the area of the display canvas
that shows the graph is redrawn. This method is ordinarily called by a
Controller.
|
discontinuity | void discontinuity(Point p1, double t1, Point p2, double t2, int depth)(Code) | | |
draw | public synchronized void draw(Graphics g, boolean coordsChanged)(Code) | | Draw the graph (possibly recomputing the data if the CoordinateRect has changed).
This is not usually called directly.
|
getColor | public Color getColor()(Code) | | Get the color that is used to draw the graph.
|
getIntervals | public Value getIntervals()(Code) | | Get the value object, possibly null, that determines the number of points on the curve.
|
getTMax | public Value getTMax()(Code) | | Get the Value object, possibly null, that gives the right endpoint of the domain of the parameter.
|
getTMin | public Value getTMin()(Code) | | Get the Value object, possibly null, that gives the left endpoint of the domain of the parameter.
|
getXFunction | public Function getXFunction()(Code) | | Get the (possibly null) function that gives the x-coordinate of the curve.
|
getYFunction | public Function getYFunction()(Code) | | Get the (possibly null) function that gives the y-coordinate of the curve.
|
setColor | public void setColor(Color c)(Code) | | Set the color to be used for drawing the graph.
|
setFunctions | public synchronized void setFunctions(Function x, Function y)(Code) | | Sets the functions that gives the coordinates of the curve to be graphed. If either function is
null, then nothing is drawn. If non-null, each function must be a function of one variable.
|
setIntervals | public void setIntervals(Value intervalCount)(Code) | | Specify the number of subintervals into which the domain of the parametric curve is divided.
The interval (tmin,tmax) is divided into subintervals. X and y coordinates of the parametric curve
are computed at each endpoint of these subintervals, and then the points are connected by lines.
If the parameter of this function is null, or if no interval count is ever specified, then a
default value of 200 is used.
|
setLimits | public void setLimits(Value tmin, Value tmax)(Code) | | Set the Value objects that specify the domain of the paratmeter.
|
setTMax | public void setTMax(Value tmax)(Code) | | Set the Value object that gives the right endpoint of the domain of the parameter. If this is null,
then a default value of 5 is used for the right endpoint. (Note: actually, it's not required that
tmin be less than tmax, so this might really be the "left" endpoint.)
|
setTMin | public void setTMin(Value tmin)(Code) | | Set the Value object that gives the left endpoint of the domain of the parameter. If this is null,
then a default value of -5 is used for the left endpoint. (Note: actually, it's not required that
tmin be less than tmax, so this might really be the "right" endpoint.)
|
setXFunction | public synchronized void setXFunction(Function x)(Code) | | Set the function that gives the x-coordinate of the curve to be graphed. If this is
null, then nothing is drawn. If non-null, it must be a function of one variable.
|
setYFunction | public synchronized void setYFunction(Function y)(Code) | | Set the function that gives the y-coordinate of the curve to be graphed. If this is
null, then nothing is drawn. If non-null, it must be a function of one variable.
|
|
|