|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.Tangent
Class Tangent encapsulates an interface Strategy
that defines the requirement for a strategy that can automatically use the
vertex array and boundary information to generate the tangent array for
Bezier curves.
Class Tangent also provides some examples of Strategy objects
via factory methods and also makes their methods directly available as public
static methods in the class to permit others to create Strategy objects.
Class Tangent cannot be instantiated.
| Nested Class Summary | |
static interface |
Tangent.Strategy
The Strategy interface requires methods that
return the tangent array for a closed or open Bezier curve
from its vertex array and, if needed, its end tangent data. |
| Field Summary | |
private static int |
maxTerms
The maximum number of terms for which the bezierStrategy will be cached and the maximum number of terms needed to achieve practical smoothness. |
private static int |
minTerms
The minimum number of terms for which the bezierStrategy will be used. |
private static Tangent.Strategy |
standardBezierStrategy
The bezierStrategy cache. |
| Constructor Summary | |
private |
Tangent()
Private constructor to prevent instantiation. |
| Method Summary | |
static float[] |
bezierCoefficients(int N,
int terms)
Returns the coefficients needed to compute the Bezier tangents corresponding to the length of the vertex data. |
static Tangent.Strategy |
bezierStrategy()
Returns the strategy that encapsulates the bezierTangents method using sufficient terms to guarantee second derviative smoothness in practical situations. |
static Tangent.Strategy |
bezierStrategy(int terms)
Returns the strategy that encapsulates the bezierTangents method using the given number of terms. |
static float[][] |
bezierTangents(float[][] vertex,
float[][] endTangent,
int terms)
Returns the unique Bezier tangents to make a smooth open cubic spline curve through the given vertex data and with the given endTangent data. |
static float[][] |
bezierTangents(float[][] vertex,
int terms)
Returns the unique Bezier tangents to make a smooth closed cubic spline curve through the given vertex data. |
static Tangent.Strategy |
chordStrategy(float factor)
Returns the strategy that encapsulates the chordTangents method. |
static float[][] |
chordTangents(float[][] vertex,
float factor)
Returns a tangent array for a closed cubic spline curve that is computed from the given vertex array by a chord-based strategy. |
static float[][] |
chordTangents(float[][] vertex,
float[][] endTangent,
float factor)
Returns a tangent array for an open cubic spline curve that is computed from the given vertex array and the given endTangent data by a chord-based strategy. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final int minTerms
private static final int maxTerms
private static final Tangent.Strategy standardBezierStrategy
| Constructor Detail |
private Tangent()
| Method Detail |
public static Tangent.Strategy bezierStrategy()
Returns the strategy that encapsulates the bezierTangents method using sufficient terms to guarantee second derviative smoothness in practical situations.
In this implementation, the maximum number of terms used is 7.
See, Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584.
bezierStrategy(int),
bezierTangents(float[][], int)public static Tangent.Strategy bezierStrategy(int terms)
Returns the strategy that encapsulates the bezierTangents method using the given number of terms.
If terms < 1, then terms is set to 1.
See, Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584.
terms - the maximum number of terms to use in computing each tangent
bezierStrategy(),
bezierTangents(float[][], int)
public static float[][] bezierTangents(float[][] vertex,
int terms)
Returns the unique Bezier tangents to make a smooth closed cubic spline curve through the given vertex data.
In this context smooth means that the first derivative is continuous at each vertex and the degree of continuity of the second derivative at each vertex is controlled by the number of terms used to compute the tangent.
If terms >= 7, then in practical situations, the second derivative will be continuous. Using a smaller value of terms will mean that fewer points affect the computation of the tangent at each vertex at the cost of some loss of continuity of the second derivative at each vertex.
Precondition: For some integer N >= 0:
null entriesPostcondition: For the same integer N:
null entriesIf the vertex array fails its precondition then float[0][2] is returned.
If terms < 1, then terms is set to 1.
See, Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584.
vertex - the vertex dataterms - the maximum number of terms to use in computing each tangent
bezierStrategy(),
bezierStrategy(int),
bezierCoefficients(int, int)
public static float[][] bezierTangents(float[][] vertex,
float[][] endTangent,
int terms)
Returns the unique Bezier tangents to make a smooth open cubic spline curve through the given vertex data and with the given endTangent data.
In this context smooth means that the first derivative is continuous at each vertex and the degree of continuity of the second derivative at each vertex is controlled by the number of terms used to compute the tangent.
If terms >= 7, then in practical situations, the second derivative will be continuous. Using a smaller value of terms will mean that fewer points affect the computation of the tangent at each vertex at the cost of some loss of continuity of the second derivative at each vertex.
Precondition 1. For some integer N >= 0:
null entriesPrecondition 2.
null or
float[2][2] with non-null entriesPostcondition 1. For the same integer N:
null entriesPostcondition 2: If the endTangent array is null,
then the function returns bezierTangents(vertex, terms).
In other words, the fact that the curve is open is ignored.
Postcondition 3: If the endTangent array is non-null:
tangent[0][i] == endTangent[0][i]tangent[N-1][i] == endTangent[1][i]If the vertex array fails its precondition then float[0][2] is returned.
If the endTangent array fails its precondition then it is treated as if
it were null.
If terms < 1, then terms is set to 1.
See, Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584.
vertex - the vertex dataendTangent - the tangent data for the ends of the open curveterms - the maximum number of terms to use in computing each tangent
bezierStrategy(),
bezierStrategy(int),
bezierCoefficients(int, int)
public static float[] bezierCoefficients(int N,
int terms)
Returns the coefficients needed to compute the Bezier tangents corresponding to the length of the vertex data.
Note that: If length <= 2, returns the empty array: float[0]. For such a length, the coefficients are not in fact used in the algorithm.
If terms < 1, then terms is set to 1.
See, Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584.
N - the length of the vertex data arrayterms - the maximum number of terms to use in computing each tangent
bezierTangents(float[][], int)public static Tangent.Strategy chordStrategy(float factor)
factor - the fraction of the chord to use as the tangent
chordTangents(float[][], float)
public static float[][] chordTangents(float[][] vertex,
float factor)
Returns a tangent array for a closed cubic spline curve that is computed from the given vertex array by a chord-based strategy.
Specifically, the rule for tangent computation is:
tangent[i] = factor * (vertex[i+1] - vertex[i-1]).This technique for computing the tangent array ensures that each tangent is influenced only by the two neighboring vertex points.
Precondition: For some integer N >= 0:
null entriesPostcondition: For the same integer N:
null entriesIf the vertex array fails its precondition then float[0][2] is returned.
vertex - the vertex datafactor - the fraction of the chord to use as the tangent
chordStrategy(float)
public static float[][] chordTangents(float[][] vertex,
float[][] endTangent,
float factor)
Returns a tangent array for an open cubic spline curve that is computed from the given vertex array and the given endTangent data by a chord-based strategy.
Specifically, the rules for tangent computation are:
tangent[i] = factor * (vertex[i+1] - vertex[i-1]).Precondition 1. For some integer N >= 0:
null entriesPrecondition 2.
null or
float[2][2] with non-null entriesPostcondition 1. For the same integer N:
null entriesPostcondition 2: If the endTangent array is null,
then the function returns chordTangents(vertex, factor).
In other words, the fact that the curve is open is ignored.
Postcondition 3: If the endTangent array is non-null:
tangent[0][i] == endTangent[0][i]tangent[N-1][i] == endTangent[1][i]If the vertex array fails its precondition then float[0][2] is returned.
If the endTangent array fails its precondition then it is treated as if
it were null.
vertex - the vertex datafactor - the fraction of the chord to use as the tangent
chordStrategy(float)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||