public class ControlPath extends Object
A ControlPath is a container of Point objects and Curve objects. The control-path uses arrays to store the points and curves. Methods that accept objects will throw an IllegalArgumentException if those objects are null. Methods that accept index values will throw an IllegalArgumentException if those index values are out of range.
Constructor and Description |
---|
ControlPath()
Creates a control-path.
|
Modifier and Type | Method and Description |
---|---|
void |
addCurve(Curve c)
Adds a curve to the curve array at index location numCurves.
|
void |
addPoint(Point p)
Adds a point to the point array at index location numPoints.
|
void |
ensureCurveCapacity(int capacity)
Checks that the curve array has the specified capacity, otherwise the capacity of the
curve array is increased to be the maximum between twice the current capacity or
the specified capacity.
|
void |
ensurePointCapacity(int capacity)
Checks that the point array has the specified capacity, otherwise the capacity of the
point array is increased to be the maximum between twice the current capacity or
the specified capacity.
|
Curve |
getCurve(int index)
Returns the curve at the specified index.
|
Point |
getPoint(int index)
Returns the point at the specified index.
|
void |
insertCurve(Curve c,
int index)
Inserts a curve at the specified index in the curve array.
|
void |
insertPoint(Point p,
int index)
Inserts a point at the specified index in the point array.
|
int |
numCurves()
Returns the number of curves in the control-path.
|
int |
numPoints()
Returns the number of points in the control-path.
|
void |
removeCurve(Curve c)
Removes the first occurrence of the specified curve from the curve array.
|
void |
removeCurve(int index)
Removes the curve at the specified index location.
|
void |
removePoint(int index)
Removes the point at the specified index location.
|
void |
removePoint(Point p)
Removes the first occurrence of the specified point from the point array.
|
Curve |
setCurve(Curve c,
int index)
Sets a curve at the specified index in the curve array, returning the curve
that was at that index.
|
Point |
setPoint(Point p,
int index)
Sets a point at the specified index in the point array, returning the point
that was at that index.
|
void |
trimCurveArray()
Creates a new curve array of exact size, copying the curves from the old array into the
new one.
|
void |
trimPointArray()
Creates a new point array of exact size, copying the points from the old array into the
new one.
|
public void addCurve(Curve c)
IllegalArgumentException
- If the specified curve is null.public void addPoint(Point p)
IllegalArgumentException
- If the specified point is null.public void insertCurve(Curve c, int index)
IllegalArgumentException
- If the specified curve is null.public void insertPoint(Point p, int index)
IllegalArgumentException
- If the specified point is null.public Curve setCurve(Curve c, int index)
IllegalArgumentException
- If the specified curve is null.public Point setPoint(Point p, int index)
IllegalArgumentException
- If the specified point is null.public Curve getCurve(int index)
public Point getPoint(int index)
public int numCurves()
public int numPoints()
public void removeCurve(Curve c)
public void removePoint(Point p)
public void removeCurve(int index)
public void removePoint(int index)
public void ensureCurveCapacity(int capacity)
public void ensurePointCapacity(int capacity)
public void trimCurveArray()
public void trimPointArray()
Copyright © 2016. All rights reserved.