Example usage for javax.media.j3d RotPosPathInterpolator RotPosPathInterpolator

List of usage examples for javax.media.j3d RotPosPathInterpolator RotPosPathInterpolator

Introduction

In this page you can find the example usage for javax.media.j3d RotPosPathInterpolator RotPosPathInterpolator.

Prototype

public RotPosPathInterpolator(Alpha alpha, TransformGroup target, Transform3D axisOfTransform, float[] knots,
        Quat4f[] quats, Point3f[] positions) 

Source Link

Document

Constructs a new interpolator that varies the rotation and translation of the target TransformGroup's transform.

Usage

From source file:TextureTest.java

protected Interpolator createInterpolator(TransformGroup objTrans) {
    Transform3D t3d = 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);
    t3d.set(axis);/*from  w  ww .j  a  v  a2s  .  c  o  m*/

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

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

    Alpha alpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 10000, 0, 0, 0, 0, 0);

    RotPosPathInterpolator rotPosPath = new RotPosPathInterpolator(alpha, objTrans, t3d, knots, quats,
            positions);
    rotPosPath.setSchedulingBounds(createApplicationBounds());

    return rotPosPath;
}