Class EDU.emporia.mathtools.SplineCurve
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.emporia.mathtools.SplineCurve

Object
   |
   +----ParametricCurve
           |
           +----EDU.emporia.mathtools.SplineCurve

public class SplineCurve
extends ParametricCurve
This creates a parameterized curve whose graph is a cubic spline approximation through a given set of points.

Version:
1.0
Author:
Joe Yanik
Since:
6/12/2001

Variable Index

 o autoSlope
A vector that keeps track of whether the slope at any given point should be calculated automatically or whether the value that is specified should be used.
 o points
The vector of points that define the curve
 o slopes
The vector of points that are used to specify the slope of the curve at any point.

Constructor Index

 o EDU.emporia.mathtools.SplineCurve()
no-argument constructor
 o EDU.emporia.mathtools.SplineCurve(Point2D.Double[])
Version of the construct that accepts as a parameter an array of points to be used to construct the curve.
 o EDU.emporia.mathtools.SplineCurve(Point2D.Double[], Point2D.Double[])
Version of the constructor that takes an array of points and an array of slopes to be used to construct the curve

Method Index

 o addPoint(Point2D.Double)
Adds a point to be used to construct the curve.
 o addPoint(double, double)
Adds a point to be used to construct the curve.
 o addPoint(Point2D.Double, Point2D.Double)
Adds a point to be used by the curve and a another point to be used as a tangent vector to the curve
 o addPoint(double, double, double, double)
Adds a point and specifies a tangent vector at that point.
 o addPoints(Point2D.Double[])
Adds an array of points to be used to define the curve
 o addPoints(Point2D.Double[], Point2D.Double[])
Adds an array of points along with an array of slopes.
 o clearPoints()
Clears all points out.
 o getPoint(double)
Returns the point corresponding to the specified index
 o getPoints()
Gets the array of points that are being used to define the curve
 o getSlopes()
Gets the slopes that are used to construct the slopes.
 o removeAllPoints()
Clears all the points out to go back to an empty curve.
 o removePoint(Point2D.Double)
Removes the point from the list of points to be used
 o removePoint()
Removes the last point that was added.
 o removePoint(double, double)
Removes the point from the list of points to be used
 o setSlope(Point2D.Double, Point2D.Double)
Sets the slope of the curve at the point specified.
 o setSlope(double, double, double, double)
This will set the tangent vector for the curve at the point that is given.

Variables

 o autoSlope
protected java.util.Vector autoSlope
A vector that keeps track of whether the slope at any given point should be calculated automatically or whether the value that is specified should be used.

 o points
protected java.util.Vector points
The vector of points that define the curve

 o slopes
protected java.util.Vector slopes
The vector of points that are used to specify the slope of the curve at any point.

Constructors

 o SplineCurve
public SplineCurve()
no-argument constructor

 o SplineCurve
public SplineCurve(EDU.emporia.mathtools.Point2D.Double[] p)
Version of the construct that accepts as a parameter an array of points to be used to construct the curve.

Parameters:
p - The array of points to be added.
 o SplineCurve
public SplineCurve(EDU.emporia.mathtools.Point2D.Double[] p,
                   EDU.emporia.mathtools.Point2D.Double[] m)
Version of the constructor that takes an array of points and an array of slopes to be used to construct the curve

Parameters:
p - The array of points. The curve will pass through each point in the array

Methods

 o addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p)
Adds a point to be used to construct the curve. The curve will then pass through this point

Parameters:
p - The point to be added
 o addPoint
public void addPoint(double x,
                     double y)
Adds a point to be used to construct the curve.

Parameters:
x - The x-coordinate of the point
y - The y-coordinate of the point
 o addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p,
                     EDU.emporia.mathtools.Point2D.Double slope)
Adds a point to be used by the curve and a another point to be used as a tangent vector to the curve

Parameters:
p - The point to be added. The curve will pass through this point
slope - A tangent vector to the curve at the point that is added.
 o addPoint
public void addPoint(double x,
                     double y,
                     double xSlope,
                     double ySlope)
Adds a point and specifies a tangent vector at that point.

Parameters:
x - The x coordinate of the point to be added.
y - The y-coordinate of the point to be added.
xSlope - The value of dx/dt at the point that is added
ySlope - The value of dy/dt at the point that is added.
 o addPoints
public void addPoints(EDU.emporia.mathtools.Point2D.Double[] p)
Adds an array of points to be used to define the curve

Parameters:
p - The array of points
 o addPoints
public void addPoints(EDU.emporia.mathtools.Point2D.Double[] p,
                      EDU.emporia.mathtools.Point2D.Double[] m)
Adds an array of points along with an array of slopes. If the arrays aren't the same size it uses the smallest one to determine the number of points to be added.

Parameters:
p - The array of points to be added.
m - The array that will determine the slopes at those points.
 o clearPoints
public void clearPoints()
Clears all points out. (The same as removeAllPoints)

 o getPoint
public EDU.emporia.mathtools.Point2D getPoint(double u)
Returns the point corresponding to the specified index

Parameters:
u - The index of the point.
Returns:
The point at that index. If the index is outside the bounds of the defined point it returns a point both of whose coordinates are Double.NaN
Overrides:
getPoint in class ParametricCurve
 o getPoints
public EDU.emporia.mathtools.Point2D.Double[] getPoints()
Gets the array of points that are being used to define the curve

Returns:
The array of points
 o getSlopes
public double[] getSlopes()
Gets the slopes that are used to construct the slopes.

Returns:
An array of points that are used to construct the curve. They will all be tangent vectors.
 o removeAllPoints
public void removeAllPoints()
Clears all the points out to go back to an empty curve.

 o removePoint
public void removePoint(EDU.emporia.mathtools.Point2D.Double p)
Removes the point from the list of points to be used

Parameters:
p - The point to be removed
 o removePoint
public void removePoint()
Removes the last point that was added. If there are no points it does nothing.

 o removePoint
public void removePoint(double x,
                        double y)
Removes the point from the list of points to be used

Parameters:
x - The x-coordinate of the point to be used
y - The y-coordinate of the point to be used
 o setSlope
public void setSlope(EDU.emporia.mathtools.Point2D.Double p,
                     EDU.emporia.mathtools.Point2D.Double slope) throws IllegalPointError
Sets the slope of the curve at the point specified.

Parameters:
p - The point at which the slope is to be set.
slope - The point that will be a tangent vector to the point.
Throws: IllegalPointError
This will be thrown if the point is not one of the data points for the curve.
 o setSlope
public void setSlope(double x,
                     double y,
                     double xSlope,
                     double ySlope) throws IllegalPointError
This will set the tangent vector for the curve at the point that is given.

Parameters:
x - The x coordinate of the point where the slope is to be set.
y - The y coordinate of the point where the slope is to be specified.
xSlope - The value of dx/dt at the point.
ySlope - The value of dy/dt at the point.
Throws: IllegalPointError

All Packages  Class Hierarchy  This Package  Previous  Next  Index