Class CubicSplineSegment
- java.lang.Object
-
- com.sun.j3d.utils.behaviors.interpolators.CubicSplineSegment
-
public class CubicSplineSegment extends java.lang.ObjectThe CubicSplineSegment class creates the representation of a TCB (Kochanek-Bartels Spline). This class takes 4 key frames as its input (using TCBKeyFrame). If interpolating between the ith and (i+1)th key frame then the four key frames that need to be specified are the (i-1)th, ith, (i+1)th and (i+2)th keyframes in order. The CubicSegmentClass then pre-computes the hermite interpolation basis coefficients if the (i+1)th frame has the linear flag set to zero. These are used to calculate the interpolated position, scale and quaternions when they requested by the user using the getInterpolated* methods. If the the (i+1)th frame's linear flag is set to 1 then the class uses linear interpolation to calculate the interpolated position, sccale and quaternions it returns through the getInterpolated* methods.- Since:
- Java3D 1.1
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatcomputeLength(float u)Computes the length of the curve at a given point between key frames.voidgetInterpolatedPosition(float u, javax.vecmath.Point3f newPos)Computes the interpolated position along the curve at a given point between key frames and returns a Point3f with the interpolated x, y, and z scale components.voidgetInterpolatedPositionVector(float u, javax.vecmath.Vector3f newPos)Computes the interpolated position along the curve at a given point between key frames and returns a Vector3f with the interpolated x, y, and z scale components.voidgetInterpolatedQuaternion(float u, javax.vecmath.Quat4f newQuat)Computes the interpolated quaternion along the curve at a given point between key frames.voidgetInterpolatedScale(float u, javax.vecmath.Point3f newScale)Computes the interpolated scale along the curve at a given point between key frames and returns a Point3f with the interpolated x, y, and z scale components.floatgetInterpolatedValue(float u)Computes the ratio of the length of the spline from the ith key frame to the position specified by u to the length of the entire spline segment from the ith key frame to the (i+1) th key frame.
-
-
-
Method Detail
-
computeLength
public float computeLength(float u)
Computes the length of the curve at a given point between key frames.- Parameters:
u- specifies the point between keyframes where 0 <= u <= 1.
-
getInterpolatedQuaternion
public void getInterpolatedQuaternion(float u, javax.vecmath.Quat4f newQuat)Computes the interpolated quaternion along the curve at a given point between key frames. This routine uses linear interpolation if the (i+1)th key frame's linear value is equal to 1.- Parameters:
u- specifies the point between keyframes where 0 <= u <= 1.newQuat- returns the value of the interpolated quaternion
-
getInterpolatedScale
public void getInterpolatedScale(float u, javax.vecmath.Point3f newScale)Computes the interpolated scale along the curve at a given point between key frames and returns a Point3f with the interpolated x, y, and z scale components. This routine uses linear interpolation if the (i+1)th key frame's linear value is equal to 1.- Parameters:
u- specifies the point between keyframes where 0 <= u <= 1.newScale- returns the interpolated x,y,z scale value in a Point3f
-
getInterpolatedPosition
public void getInterpolatedPosition(float u, javax.vecmath.Point3f newPos)Computes the interpolated position along the curve at a given point between key frames and returns a Point3f with the interpolated x, y, and z scale components. This routine uses linear interpolation if the (i+1)th key frame's linear value is equal to 1.- Parameters:
u- specifies the point between keyframes where 0 <= u <= 1.newPos- returns the interpolated x,y,z position in a Point3f
-
getInterpolatedPositionVector
public void getInterpolatedPositionVector(float u, javax.vecmath.Vector3f newPos)Computes the interpolated position along the curve at a given point between key frames and returns a Vector3f with the interpolated x, y, and z scale components. This routine uses linear interpolation if the (i+1)th key frame's linear value is equal to 1.- Parameters:
u- specifies the point between keyframes where 0 <= u <= 1.newPos- returns the interpolated x,y,z position in a Vector3f.
-
getInterpolatedValue
public float getInterpolatedValue(float u)
Computes the ratio of the length of the spline from the ith key frame to the position specified by u to the length of the entire spline segment from the ith key frame to the (i+1) th key frame. When the (i+1)th key frame's linear value is equal to 1, this is meaninful otherwise it should return u.- Parameters:
u- specifies the point between keyframes where 0 <= u <= 1.- Returns:
- the interpolated ratio
-
-