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
-
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.
-
points
- The vector of points that define the curve
-
slopes
- The vector of points that are used to specify the slope of the curve at any point.
-
EDU.emporia.mathtools.SplineCurve()
- no-argument constructor
-
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.
-
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
-
addPoint(Point2D.Double)
- Adds a point to be used to construct the curve.
-
addPoint(double, double)
- Adds a point to be used to construct the curve.
-
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
-
addPoint(double, double, double, double)
- Adds a point and specifies a tangent vector at that point.
-
addPoints(Point2D.Double[])
- Adds an array of points to be used to define the curve
-
addPoints(Point2D.Double[], Point2D.Double[])
- Adds an array of points along with an array of slopes.
-
clearPoints()
- Clears all points out.
-
getPoint(double)
- Returns the point corresponding to the specified index
-
getPoints()
- Gets the array of points that are being used to define the curve
-
getSlopes()
- Gets the slopes that are used to construct the slopes.
-
removeAllPoints()
- Clears all the points out to go back to an empty curve.
-
removePoint(Point2D.Double)
- Removes the point from the list of points to be used
-
removePoint()
- Removes the last point that was added.
-
removePoint(double, double)
- Removes the point from the list of points to be used
-
setSlope(Point2D.Double, Point2D.Double)
- Sets the slope of the curve at the point specified.
-
setSlope(double, double, double, double)
- This will set the tangent vector for the curve at the point that is given.
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.
points
protected java.util.Vector points
- The vector of points that define the curve
slopes
protected java.util.Vector slopes
- The vector of points that are used to specify the slope of the curve at any point.
SplineCurve
public SplineCurve()
- no-argument constructor
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.
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
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
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
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.
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.
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
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.
clearPoints
public void clearPoints()
- Clears all points out. (The same as removeAllPoints)
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
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
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.
removeAllPoints
public void removeAllPoints()
- Clears all the points out to go back to an empty curve.
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
removePoint
public void removePoint()
- Removes the last point that was added. If there are no points it does nothing.
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
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.
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