Class EDU.emporia.mathbeans.MathGrapher
All Packages Class Hierarchy This Package Previous Next Index
Class EDU.emporia.mathbeans.MathGrapher
Object
|
+----Component
|
+----Container
|
+----JComponent
|
+----JPanel
|
+----MathGrid
|
+----EDU.emporia.mathbeans.MathGrapher
- public class MathGrapher
- extends MathGrid
MathGrapher is capable of displaying graphs of curves and of discrete points
- Version:
- 1.3
- Author:
- Joe Yanik
- Since:
- 6/30/00
-
defaultPointColor
- The default color to be used when no color is specified for a given point
-
discretePoints
- The array of discrete points to be graphed on the MathGrapher
-
f
- Parameter used to add a graph to the MathGrapher
-
g
- Parameter used to add a graph to the MathGrapher
-
graph
- The graph array will contain the graphs to be graphed
-
graphColor
- An array of colors to be used to draw the graphs in different colors
-
graphCounter
- The number of graphs currently being displayed
-
graphPoints
- The graphPoints arrays will contain the points to be used to plot
the graphs
-
maxNumberOfGraphs
- The maximum number of graphs that can be displayed at one time
-
point
- point is will reference the Point2D object used by plotPoints to be displayed.
-
pointColors
- An array of Color objects that will determine the color to be used to
display each point.
-
pointPlotted
- pointPlotted is a boolean used to keep track of the first time that
pointPlot is called.
-
pointRadius
- The radius (in pixels) used to draw the discrete points.
-
tDelta
- The tMin array keeps track of the current value of tMin for each curve.
-
tMax
- The tMin array keeps track of the current value of tMin for each curve.
-
tMin
- The tMin array keeps track of the current value of tMin for each curve.
-
tTraceHome
- The "home point" for the trace
-
traceEnabled
- Keeps track of whether or not the trace feature is enabled
-
traceGraph
- This will correspond to the index of the graph to be traced at the moment
-
traceMultiplier
- This will be incremented or decremented as the graph is traced.
-
xPixelWidth
- The mathematical width of one pixel on the coordinate system
-
xTraceMath
- xTraceMath is the mathematical x-coordinate of the current point displayed
in the trace
-
yTraceMath
- xTraceMath is the mathematical x-coordinate of the current point displayed
in the trace
-
EDU.emporia.mathbeans.MathGrapher()
-
-
addGraph(Graphable)
- addGraph adds a new Graph to the MathGrapher
-
addGraph(Graphable, Color)
- Another version of addGraph that allows you to specify the color of the
graph.
-
addPoint(Point2D.Double)
- Adds a new point to be displayed using the default color.
-
addPoint(Point2D.Double, Color)
- A version of the addPoint method that allows you to specify the color
used to display the point.
-
addPoint(double, double)
- Another version of the addPoint method that accepts the coordinates of
the point as parameters
-
addPoint(double, double, Color)
- Still another version of the addPoint method
that specifies the color.
-
addPoints(Point2D.Double[])
- Adds all the points to the graph
-
getF()
- Gets the parameter f
-
getG()
- Gets the value of the parameter g
-
getPointRadius()
- Returns the radius (in pixels) that will be used to plot the discrete
points.
-
isTraceEnabled()
- Determines whether or not the trace feature is enabled
-
main(String[])
-
-
paintComponent(Graphics)
- Paints the Grid
-
plotPoint(double, double)
- Plots the point with indicated coordinates.
-
removeAllPoints()
- Removes all points from the graph
-
removeGraph()
- removeGraph will remove the most recently displayed graph
-
removeGraph(int)
- Removes the graph at the indicated index
-
removeGraph(Graphable)
- Removes the specified graph
-
removePoint(Point2D.Double)
- Removes the point from the graph.
-
setF(Graphable)
- Sets the values of the Graphable object f which would then be added
to the MathGrapher
-
setG(Graphable)
- Sets the parameter g
-
setPointRadius(int)
- Sets the radius (in pixels) of the discrete points to be plotted on the
graph.
-
setTraceEnabled(boolean)
- Sets whether or not the trace feature is enabled
-
updateGraph()
- updateGraph should be called whenever a new graph has been added or when
one of the graphs that has already been added has changed
-
updateParameters()
- updateParameters readjusts all the parameters of the graph.
-
updateTrace()
- updateTrace adjusts the parameters to display the new trace point
defaultPointColor
protected java.awt.Color defaultPointColor
- The default color to be used when no color is specified for a given point
discretePoints
protected java.util.Vector discretePoints
- The array of discrete points to be graphed on the MathGrapher
f
protected EDU.emporia.mathtools.Graphable f
- Parameter used to add a graph to the MathGrapher
g
protected EDU.emporia.mathtools.Graphable g
- Parameter used to add a graph to the MathGrapher
graph
protected EDU.emporia.mathtools.Graphable[] graph
- The graph array will contain the graphs to be graphed
graphColor
protected java.awt.Color[] graphColor
- An array of colors to be used to draw the graphs in different colors
graphCounter
protected int graphCounter
- The number of graphs currently being displayed
graphPoints
protected EDU.emporia.mathtools.Point2D[][] graphPoints
- The graphPoints arrays will contain the points to be used to plot
the graphs
maxNumberOfGraphs
protected int maxNumberOfGraphs
- The maximum number of graphs that can be displayed at one time
point
protected EDU.emporia.mathtools.Point2D.Double point
- point is will reference the Point2D object used by plotPoints to be displayed.
pointColors
protected java.util.Vector pointColors
- An array of Color objects that will determine the color to be used to
display each point.
pointPlotted
protected boolean pointPlotted
- pointPlotted is a boolean used to keep track of the first time that
pointPlot is called.
pointRadius
protected int pointRadius
- The radius (in pixels) used to draw the discrete points. Must be at least
2.
tDelta
protected double[] tDelta
- The tMin array keeps track of the current value of tMin for each curve.
For functions it will be xMinCurrent
tMax
protected double[] tMax
- The tMin array keeps track of the current value of tMin for each curve.
For functions it will be xMinCurrent
tMin
protected double[] tMin
- The tMin array keeps track of the current value of tMin for each curve.
For functions it will be xMinCurrent
tTraceHome
protected double tTraceHome
- The "home point" for the trace
traceEnabled
protected boolean traceEnabled
- Keeps track of whether or not the trace feature is enabled
traceGraph
protected int traceGraph
- This will correspond to the index of the graph to be traced at the moment
traceMultiplier
protected double traceMultiplier
- This will be incremented or decremented as the graph is traced.
xPixelWidth
protected double xPixelWidth
- The mathematical width of one pixel on the coordinate system
xTraceMath
protected double xTraceMath
- xTraceMath is the mathematical x-coordinate of the current point displayed
in the trace
yTraceMath
protected double yTraceMath
- xTraceMath is the mathematical x-coordinate of the current point displayed
in the trace
MathGrapher
public MathGrapher()
addGraph
public void addGraph(Graphable h)
- addGraph adds a new Graph to the MathGrapher
- Parameters:
- h - h is a Graphable object. It could either represent a function or a
parameteric curve
addGraph
public void addGraph(Graphable h,
Color c)
- Another version of addGraph that allows you to specify the color of the
graph.
- Parameters:
- h - The Graphable object to be graphed
- c - The color that it will be graphed in.
addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p)
- Adds a new point to be displayed using the default color. Repeated invocation
of addPoint will result in additional points being displayed
- Parameters:
- p - The point to be displayed
addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p,
Color c)
- A version of the addPoint method that allows you to specify the color
used to display the point.
- Parameters:
- p - The point to be displayed
- c - The color used to display it
addPoint
public void addPoint(double x,
double y)
- Another version of the addPoint method that accepts the coordinates of
the point as parameters
- Parameters:
- x - The x-coordinate of the point
- y - The y-coordinate of the point
addPoint
public void addPoint(double x,
double y,
Color c)
- Still another version of the addPoint method
that specifies the color.
- Parameters:
- x - The mathematical x-coordinate of the point to be added
- y - The mathematical y-coordinate of the point to be added.
- c - The color used to draw the point
addPoints
public void addPoints(EDU.emporia.mathtools.Point2D.Double[] pointArray)
- Adds all the points to the graph
- Parameters:
- pointArray - The array of points to be added to the graph
getF
public EDU.emporia.mathtools.Graphable getF()
- Gets the parameter f
- Returns:
- The Graphable object f which is displayed on the Graph
getG
public EDU.emporia.mathtools.Graphable getG()
- Gets the value of the parameter g
- Returns:
- The graphable object g
getPointRadius
public int getPointRadius()
- Returns the radius (in pixels) that will be used to plot the discrete
points.
isTraceEnabled
public boolean isTraceEnabled()
- Determines whether or not the trace feature is enabled
- Returns:
- True if enabled, false otherwise
main
public static void main(String[] argv)
paintComponent
public void paintComponent(Graphics a)
- Paints the Grid
- Overrides:
- paintComponent in class MathGrid
plotPoint
public void plotPoint(double x,
double y)
- Plots the point with indicated coordinates. Repeated calls of plotPoint
will only result in the latest point being plotted.
- Parameters:
- x - The x-coordinate of the point to be plotted
- y - The y-coordinate of the point to be plotted
removeAllPoints
public void removeAllPoints()
- Removes all points from the graph
removeGraph
public void removeGraph()
- removeGraph will remove the most recently displayed graph
removeGraph
public void removeGraph(int index)
- Removes the graph at the indicated index
- Parameters:
- index - The index of the graph to be removed
removeGraph
public void removeGraph(Graphable h)
- Removes the specified graph
- Parameters:
- h - The Graphable object to be removed
removePoint
public void removePoint(EDU.emporia.mathtools.Point2D.Double p)
- Removes the point from the graph. It will remove the last occurrence
of a point whose coordinates equal the coordinates of the point that
is passed
- Parameters:
- p - The point to be removed from the graph
setF
public void setF(Graphable f)
- Sets the values of the Graphable object f which would then be added
to the MathGrapher
- Parameters:
- f - The Graphable object representing the curve to be graphed
setG
public void setG(Graphable g)
- Sets the parameter g
- Parameters:
- g - The Graphable object g
setPointRadius
public void setPointRadius(int radius)
- Sets the radius (in pixels) of the discrete points to be plotted on the
graph. Since 2 is the smallest radius that can be displayed any value
less than 2 will result in a radius of 2
- Parameters:
- radius - The radius (in pixels) of the discrete points to be plotted
setTraceEnabled
public void setTraceEnabled(boolean traceEnabled)
- Sets whether or not the trace feature is enabled
- Parameters:
- traceEnabled - When true trace will be enabled
updateGraph
public void updateGraph()
- updateGraph should be called whenever a new graph has been added or when
one of the graphs that has already been added has changed
updateParameters
protected void updateParameters()
- updateParameters readjusts all the parameters of the graph. It will be
called whenever the xRange or yRange have changed
- Overrides:
- updateParameters in class MathGrid
updateTrace
protected void updateTrace()
- updateTrace adjusts the parameters to display the new trace point
All Packages Class Hierarchy This Package Previous Next Index