|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectdata.Curve
This class represents a Bezier curve. It has 4 control points, and is able to determine the position in the curve at a given t.
| Field Summary | |
protected ControlPoint[] |
cparray
The array of ControlPoints. |
| Constructor Summary | |
Curve(ControlPoint cp1,
ControlPoint cp2,
ControlPoint cp3,
ControlPoint cp4)
Creates a new Curve with the 4 given ControlPoints. |
|
| Method Summary | |
double |
calculateX(double t)
Calculates and returns the X coordinate of the function at the specified time t by using the Bezier formula:
x = x0 * (1-t)^3 + 3 * x1 * t * (1-t)^2 + 3 * x2 * t^2 * (1-t) + x3 * t^3 |
double |
calculateY(double t)
Calculates and returns the Y coordinate of the function at the specified time t by using the Bezier formula:
y = y0 * (1-t)^3 + 3 * y1 * t * (1-t)^2 + 3 * y2 * t^2 * (1-t) + y3 * t^3 |
ControlPoint |
getControlPoint(int index)
Returns the ControlPoint identified by P(index) as
in the Bezier formula. |
void |
setControlPoint(int index,
ControlPoint cp)
Sets the ControlPoint at index (identified by
P(index) as in the Bezier formula) of this Curve to
the given ControlPoint. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected ControlPoint[] cparray
ControlPoints.
| Constructor Detail |
public Curve(ControlPoint cp1,
ControlPoint cp2,
ControlPoint cp3,
ControlPoint cp4)
ControlPoints.
cp1 - The first ControlPoint.cp2 - The second ControlPoint.cp3 - The third ControlPoint.cp4 - The fourth ControlPoint.| Method Detail |
public ControlPoint getControlPoint(int index)
ControlPoint identified by P(index) as
in the Bezier formula.
index - The index of the ControlPoint you want. Must be
between 0 and 3, inclusive.
ControlPoint at index.
public void setControlPoint(int index,
ControlPoint cp)
ControlPoint at index (identified by
P(index) as in the Bezier formula) of this Curve to
the given ControlPoint.
index - The index of the ControlPoint you want to set. Must
be between 0 and 3, inclusive.cp - The ControlPoint you want to set.public double calculateX(double t)
Calculates and returns the X coordinate of the function at the specified
time t by using the Bezier formula:
x = x0 * (1-t)^3 + 3 * x1 * t * (1-t)^2 + 3 * x2 * t^2 * (1-t) + x3 * t^3
t - The time parameter for the Bezier formula. Must be within 0 and 1,
inclusive.
t.public double calculateY(double t)
Calculates and returns the Y coordinate of the function at the specified
time t by using the Bezier formula:
y = y0 * (1-t)^3 + 3 * y1 * t * (1-t)^2 + 3 * y2 * t^2 * (1-t) + y3 * t^3
t - The time parameter for the Bezier formula. Must be within 0 and 1,
inclusive.
t.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||