Class EDU.emporia.mathtools.SplineFunction
All Packages Class Hierarchy This Package Previous Next Index
Class EDU.emporia.mathtools.SplineFunction
Object
|
+----MathFunction
|
+----EDU.emporia.mathtools.SplineFunction
- public class SplineFunction
- extends MathFunction
A class that constructs a cubic spline passing through a
specified set of points. The slope at each point can be
specified or generated automatically.
- Version:
- 1.0
- Author:
- Joe Yanik
- Since:
- 6/6/2001
-
autoSlope
- An Vector of boolean values that keeps track of whether the slope
at each point should stay fixed or should be automatically
adjusted as new points are added.
-
points
- The Vector that will contain the points used to define the function.
-
slopes
- The Vector that will be used to define the slopes that will be
used to define the curve.
-
EDU.emporia.mathtools.SplineFunction()
-
-
EDU.emporia.mathtools.SplineFunction(Point2D.Double[])
-
-
addPoint(Point2D.Double)
- Adds the indicated point to the list of points used to construct the function.
-
addPoint(Point2D.Double, double)
- Adds the indicated points to the list of points and specifies
the slope of the curve at that point.
-
addPoint(double, double, double)
- Adds a point with the given x and y coordinates and specifies the
slope at that point.
-
addPoint(double, double)
- Adds the point with the specified x and y coordinate.
-
addPoints(Point2D.Double[])
- Adds the indicate array of points to the ones that are being used to define the
function.
-
functionValue(double)
- Overrides the functionValue method of the MathFunction class.
-
getPoints()
- Gets the array of points that are being used to define the function.
-
getSlopes()
- Gets the array of slopes that are being used to define the curve.
-
removeAllPoints()
- Removes all points from the list of points that are used to define the function.
-
removePoint(Point2D.Double)
- Removes the indicated point from the list of points that are being used to
define the function
-
removePoint(double, double)
- Removes the point with the indicated x and y coordinate from the list of points
that are used to define the functoin
-
removePoint()
- Removes the point with the largest x coordinate
-
setSlope(Point2D.Double, double)
- Sets the slope of the curve at the given point
autoSlope
protected java.util.Vector autoSlope
- An Vector of boolean values that keeps track of whether the slope
at each point should stay fixed or should be automatically
adjusted as new points are added.
points
protected java.util.Vector points
- The Vector that will contain the points used to define the function. They will
always be listed in increasing order of x-value.
slopes
protected java.util.Vector slopes
- The Vector that will be used to define the slopes that will be
used to define the curve. The slope at a particular index will
correspond to the point at that same index in the points Vector.
SplineFunction
public SplineFunction()
SplineFunction
public SplineFunction(EDU.emporia.mathtools.Point2D.Double[] p)
addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p) throws IllegalPointError
- Adds the indicated point to the list of points used to construct the function.
The graph will then pass through the specified point. It will throw an exception
if there is already a point with that x-coordinate. The slope
at the point will generated automatically.
- Parameters:
- p - The point to be added.
- Throws: IllegalPointError
-
addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p,
double slope) throws IllegalPointError
- Adds the indicated points to the list of points and specifies
the slope of the curve at that point. The graph of the function
will then pass through the added point with the slope specified.
- Parameters:
- p - The point to be added.
- slope - The slope of the curve at that point.
- Throws: IllegalPointError
- This will be thrown when there is already a point with the
indicated x-value.
addPoint
public void addPoint(double x,
double y,
double slope) throws IllegalPointError
- Adds a point with the given x and y coordinates and specifies the
slope at that point.
- Parameters:
- x - The x coordinate of the point to be added.
- y - The y coordinate of the point to be added.
- slope - The slope of the curve at the added point.
- Throws: IllegalPointError
- Thrown when there is already a point with the given
x coordinate.
addPoint
public void addPoint(double x,
double y) throws IllegalPointError
- Adds the point with the specified x and y coordinate. It throws an IllegalPointError
if there is already a point with the given x-coordinate. The
slope is generated automatically.
- Parameters:
- x - The x-coordinate of the point to be added
- y - The y-coordinate of the point to be added.
- Throws: IllegalPointError
- This will be thrown is there is an attempt to add a point with the same x coordinate
as one that is already being used.
addPoints
public void addPoints(EDU.emporia.mathtools.Point2D.Double[] p) throws IllegalPointError
- Adds the indicate array of points to the ones that are being used to define the
function. If any of the points contains an x-value that is already being used
it will throw and IllegalPointError. The slopes will be
generated automatically.
- Parameters:
- p - The array of points to be added.
- Throws: IllegalPointError
- Thrown is there is a duplicate x-value.
functionValue
public double functionValue(double u)
- Overrides the functionValue method of the MathFunction class.
This method returns the value of the function at the
specified x-coordinate
- Parameters:
- u - The x-coordinate
- Returns:
- f(x)
- Overrides:
- functionValue in class MathFunction
getPoints
public EDU.emporia.mathtools.Point2D.Double[] getPoints()
- Gets the array of points that are being used to define the function.
- Returns:
- The array of points
getSlopes
public double[] getSlopes()
- Gets the array of slopes that are being used to define the curve.
- Returns:
- The array of slopes.
removeAllPoints
public void removeAllPoints()
- Removes all points from the list of points that are used to define the function.
removePoint
public void removePoint(EDU.emporia.mathtools.Point2D.Double p)
- Removes the indicated point from the list of points that are being used to
define the function
- Parameters:
- p - The point to be removed.
removePoint
public void removePoint(double x,
double y)
- Removes the point with the indicated x and y coordinate from the list of points
that are used to define the functoin
- Parameters:
- x - The x-coordinate of the point to be removed.
- y - The y-coordinate of the point to be removed.
removePoint
public void removePoint()
- Removes the point with the largest x coordinate
setSlope
public void setSlope(EDU.emporia.mathtools.Point2D.Double p,
double m) throws IllegalPointError
- Sets the slope of the curve at the given point
- Parameters:
- p - The point at which the slope is to be set.
- m - The slope at the indicated point.
- Throws: IllegalPointError
-
All Packages Class Hierarchy This Package Previous Next Index