Path interpolator classes differ from the other interpolators in that they may store two or more values for interpolation. The Java 3D core provides path interpolator classes for position interpolation, rotation interpolation, position and rotation interpolation, and position, rotation, and scale interpolation.

Using a path interpolator object follows the same recipe as other interpolator objects. The only difference is in the number of values used to initialize the path interpolator object.

  1. create the target object with the appropriate capability
  2. create the Alpha object
  3. create arrays of knot and other values
  4. create the path interpolator object referencing the Alpha object, target object, and arrays of settings
  5. add scheduling bounds to the Interpolator object
  6. add path interpolator object to the scene graph
 public BranchGroup createSceneGraph() {

    // Create the root of the branch graph
    BranchGroup objRoot = new BranchGroup();

    Alpha alpha = new Alpha(-1, 10000);
    TransformGroup target = new TransformGroup();
    Transform3D axisOfRotPos = new Transform3D();
    float[] knots = { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.6f, 0.8f, 0.9f, 1.0f };
    Quat4f[] quats = new Quat4f[9];
    Point3f[] positions = new Point3f[9];


    AxisAngle4f axis = new AxisAngle4f(1.0f, 0.0f, 0.0f, 0.0f);

    quats[0] = new Quat4f(0.0f, 1.0f, 1.0f, 0.0f);
    quats[1] = new Quat4f(1.0f, 0.0f, 0.0f, 0.0f);
    quats[2] = new Quat4f(0.0f, 1.0f, 0.0f, 0.0f);
    quats[3] = new Quat4f(0.0f, 1.0f, 1.0f, 0.0f);
    quats[4] = new Quat4f(0.0f, 0.0f, 1.0f, 0.0f);
    quats[5] = new Quat4f(0.0f, 1.0f, 1.0f, 0.0f);
    quats[6] = new Quat4f(1.0f, 1.0f, 0.0f, 0.0f);
    quats[7] = new Quat4f(1.0f, 0.0f, 0.0f, 0.0f);
    quats[8] = quats[0];

    positions[0] = new Point3f(0.0f, 0.0f, -1.0f);
    positions[1] = new Point3f(1.0f, -1.0f, -2.0f);
    positions[2] = new Point3f(-1.0f, 1.0f, -3.0f);
    positions[3] = new Point3f(2.0f, 0.0f, -4.0f);
    positions[4] = new Point3f(-2.0f, -1.0f, -5.0f);
    positions[5] = new Point3f(3.0f, 1.0f, -6.0f);
    positions[6] = new Point3f(-3.0f, 0.0f, -7.0f);
    positions[7] = new Point3f(2.0f, -1.0f, -4.0f);
    positions[8] = positions[0];

    // Create a RotPosPathInterpolator object
    RotPosPathInterpolator rotPosPath = new RotPosPathInterpolator(alpha,
        target, axisOfRotPos, knots, quats, positions);
    rotPosPath.setSchedulingBounds(new BoundingSphere());

    target.addChild(new ColorCube(0.4));


    return objRoot;