Methods Summary |
---|
public java.lang.Object[] | compute(int si, float p)Computes the value for the input interpolated values.
There should be as many entries in the return array as there
are components in the RefValues.
segments[si].compute(p, w);
return w;
|
public int | getComponents()FloatRefValues only have one component. This returns the number of
components in the start value of the first segment.
return 6;
|
public float | getLength()Computes the length of the RefValues.
return length;
|
public float | getLength(int si)Computes the length of segment at index si
return segLength[si];
|
public Segment | getSegment(int i)
return segments[i];
|
public int | getSegments()
return segments.length;
|
public void | initialize()Should be called after the RefValue's configuration is complete
to give the implementation a chance to initialize
internal data and cache values.
// Initialize the working buffer
final int nc = 6;
w = new float[nc][];
final int ns = segments.length;
// Initialize the segments.
for (int si = 0; si < ns; si++) {
segments[si].initialize();
}
length = 0;
segLength = new float[ns];
// The length of a TransformSegment, along each component, is the
// sum of the length of each segment along that component.
for (int ci = 0; ci < nc; ci++) {
w[ci] = new float[1];
}
for (int si = 0; si < ns; si++) {
segLength[si] = segments[si].getLength();
length += segLength[si];
}
|
public void | makeDiscrete()Adds a new time segment so accomodate for discreet behavior.
If there is only one segment for discreet animations, the
last value is never shown. To accomodate for that, this
method should add a segment to the RefValues so that the
last animation value is shown during the last value interval
of a discreet animation.
TransformSegment[] tmpSegments =
new TransformSegment[segments.length + 1];
System.arraycopy(segments, 0, tmpSegments, 0, segments.length);
TransformSegment lastSeg = segments[segments.length - 1];
TransformSegment newSeg = new TransformSegment();
newSeg.start = lastSeg.end;
newSeg.end = lastSeg.end;
newSeg.type = lastSeg.type;
tmpSegments[tmpSegments.length - 1] = newSeg;
segments = tmpSegments;
|