java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Java3D arrow Using the subclasses of PathInterpolator
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4086
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
Using the subclasses of PathInterpolator E-mail
User Rating: / 8
PoorBest 

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

Image

public BranchGroup createSceneGraph() {

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

    Alpha alpha = new Alpha(-110000);
    TransformGroup target = new TransformGroup();
    Transform3D axisOfRotPos = new Transform3D();
    float[] knots = 0.0f0.1f0.2f0.3f0.4f0.6f0.8f0.9f1.0f };
    Quat4f[] quats = new Quat4f[9];
    Point3f[] positions = new Point3f[9];

    target.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    AxisAngle4f axis = new AxisAngle4f(1.0f0.0f0.0f0.0f);
    axisOfRotPos.set(axis);

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

    positions[0new Point3f(0.0f0.0f, -1.0f);
    positions[1new Point3f(1.0f, -1.0f, -2.0f);
    positions[2new Point3f(-1.0f1.0f, -3.0f);
    positions[3new Point3f(2.0f0.0f, -4.0f);
    positions[4new Point3f(-2.0f, -1.0f, -5.0f);
    positions[5new Point3f(3.0f1.0f, -6.0f);
    positions[6new Point3f(-3.0f0.0f, -7.0f);
    positions[7new 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());

    objRoot.addChild(target);
    objRoot.addChild(rotPosPath);
    target.addChild(new ColorCube(0.4));

    ...

    return objRoot;
}

 Related Tips

 
< Prev

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.