// sample code for Java3D's PositionPathInterpolator Behavior.
// written by Raphael Wimmer <raphael.wimmer@ifi.lmu.de>, 2007
// This is released as Public Domain code.

Alpha alphaEarthMoonOrbit = new Alpha(-1, MY_EARTH_SPEED);
Transform3D axisOfRotPos = new Transform3D();
AxisAngle4f axis = new AxisAngle4f(1.0f, 0.0f, 0.0f, 0.0f);
axisOfRotPos.set(axis);
float[] animKnots = createUniformAnimKnots(5);
Point3f[] square = createSquare();
PositionPathInterpolator animEarthMoonOrbit = new PositionPathInterpolator(alphaEarthMoonOrbit, objEarthMoonOrbit, axisOfRotPos, animKnots, square);
animEarthMoonOrbit.setSchedulingBounds(new BoundingSphere());

private Point3f[] createSquare() {
        Point3f[] square = new Point3f[5];
	square[0] = new Point3f(-2.0f, 0f, -2.0f);        
	square[1] = new Point3f(2.0f, 0f, -2.0f);
	square[2] = new Point3f(2.0f, 0f, 2.0f);
	square[3] = new Point3f(-2.0f, 0f, 2.0f);
        square[4] = (Point3f) square[0].clone();
        return square;
    }
    
private float[] createUniformAnimKnots(int number) {
        float[] knots = new float[number];
        for (int i = 0; i < number; i++){
            knots[i] = ((float)1.0 * i) / (float) (number - 1);
        }
        return knots;
    }

