It will work: I have used it to smooth 3D spacial lines.
please find here an bit of code where I use this:
 /**
    * return an array of points interpolated from the given knots
    * it is hardcoded to being 5 times the number of knots
    * this is done by building the new inferred points from an existing
java3D
    * interpolator overloaded so that i can manually manged its output
    * @param   the base knots
    * @return  the interpolated array of points
    */
    private Point3f[] getSpline(Point3f[] knots) {
    file://build an iterator to reuse existing java3d facility
    MyAlpha  myAlpha = new MyAlpha ();
    file://create knots
    Matrix4d mat = new Matrix4d();
    Quat4f  r = new Quat4f ();
    r.set(mat); file://no rotation
    Point3f s = new Point3f(1.0f, 1.0f, 1.0f); // uniform scale
    int nb = knots.length;
    file://set the points as knots
    TCBKeyFrame[] splineKeyFrames = new TCBKeyFrame[nb];
    for (int i = 0; i < nb; i++) {
        splineKeyFrames[i] = new TCBKeyFrame((float)i/(nb - 1), 0, knots[i],
r,
                            s, 0.0f, 0.0f, 0.0f);
        }

    // create spline interpolator
    TransformGroup target = new TransformGroup();
    RotPosScaleTCBSplinePathInterpolator splineInterpolator =
         new RotPosScaleTCBSplinePathInterpolator(myAlpha, target,
                                                  new Transform3D(),
                                                   splineKeyFrames);
    Point3f[] newPoints = new Point3f[nb*5 + 1];
    file://add 5 interpolated values for each segment
    Transform3D transform3d = new Transform3D();
    Vector3d vec = new Vector3d();
    for (int i = 0 ; i <= nb * 5; i++) {
        myAlpha.setValue((float)i / (nb * 5f));
        splineInterpolator.processStimulus(null);
        target.getTransform(transform3d);
        transform3d.get(vec);
        newPoints[i] = new Point3f(vec);

    }
    return newPoints;

}


please note the use of a MyAlpha class which is an alpha I can force the
value of=>
  /*
    * Privately defined subclass of Alpha to be able to use a controlled
    * version of the iterator: here the value returned is constant and set
    * programmatically instead of varying with the time
    */
    protected class MyAlpha extends Alpha {
        float valueSet = 0f;
        public MyAlpha() {
            super(1,1);
        }
        public float value(){
            return valueSet;
        }
        public void setValue(float v) {
        valueSet = v;
        }
    }

Olivier Fillon    Minestar Project
[EMAIL PROTECTED]  Mincom Limited
Ph.+61-7-3303-3344               61 Wyandra Street
Fax+61-7-3303-3232               Teneriffe Qld. 4005.
Australia
Company home page: http://www.mincom.com/
Personal home page: http://www.powerup.com.au/~fillon
--- A word from our sponsor ---
This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please delete
it and notify the sender. The contents of this E-mail are the opinion of the
writer only and are not endorsed by Mincom Limited unless expressly stated
otherwise.

--
-----Original Message-----
From: SMM-Mohd Nordin Zakaria <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Sunday, February 06, 2000 4:06 PM
Subject: [JAVA3D] TCBSplinePathInterpolator


>Hi,
>
>Where can I find the documentation for  TCBSplinePathInterpolator ?
>I need spline or bezier interpolation for my animation. Will
>TCBSplinePathInterpolator do the job ?
>
>thanks.
>Nordin
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to