Dear Frank,
I am a relative beginner with J3D and I hope that my comment on the code
fragments is relevant. My reference docs to the constructor used for the
BoundingSphere in step 3 is:
"Constructor Summary
BoundingSphere()
Constructs and initializes a BoundingSphere with radius = 1 at 0 0
0".
The default constructor therefore may not do not do much with that radius. As
the problem appears to lie in Step 3 this seemed worth looking at.
Best regards,
Con Goldfinch
"Frank C.P. Hsu" wrote:
> Hi:
>
> I have some problems at "PositionPathInterpolator"
>
> the codes of my program is below :
>
> public BranchGroup createView()
> {
> BranchGroup BG= new BranchGroup();
> PhysicalBody body= new PhysicalBody();
> PhysicalEnvironment environment= new PhysicalEnvironment();
> View view= new View();
> ViewPlatform VP=new ViewPlatform();
>
> view.addCanvas3D(canvas3D);
> view.setPhysicalBody(body);
> view.setPhysicalEnvironment(environment);
> view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
> view.setBackClipDistance(10000.0);
> view.attachViewPlatform(VP);
>
> /* -------------- Step 1
> ---------------------------------------------------- */
>
> Transform3D TF = new Transform3D();
> Transform3D t1 = new Transform3D();
> TF.set(new Vector3d(0.0, 5.0, 0.0)); /// change the oriented
> point
> t1.rotY(Math.PI/2); /// rotate the view axis
>
> TF.mul(t1);
> TransformGroup TG = new TransformGroup(TF);
>
> /* -------------- Step 1
> ---------------------------------------------------- */
>
> TG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
> TG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>
> /*----------------- Step 2
> ---------------------------------------------------*/
> KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(TG);
> keyNavBeh.setSchedulingBounds(new BoundingSphere(new
> Point3d(),1000.0));
> BG.addChild(keyNavBeh);
> /*----------------- Step 2
> ---------------------------------------------------*/
>
> /*----------------- Step 3
> ---------------------------------------------------*/
> Alpha alpha = new Alpha(-1, 10000);
> Transform3D axisOfRotPos = new Transform3D();
> AxisAngle4f axis = new AxisAngle4f(1.0f,0.0f,0.0f,0.0f);
> axisOfRotPos.set(axis);
>
> float[] knots = {0.0f, 0.33f, 0.66f,1.0f};
> Point3f[] positions = new Point3f[4];
>
> positions[0]= new Point3f(30.0f,5.0f,20.0f);
> positions[1]= new Point3f(-10.0f,5.0f,10.0f);
> positions[2]= new Point3f(-20.0f,5.0f,20.0f);
> positions[3]= new Point3f(-30.0f,5.0f,30.0f);
>
> PositionPathInterpolator PosPath = new
> PositionPathInterpolator(alpha, TG, axisOfRotPos, knots, positions);
> PosPath.setSchedulingBounds(new BoundingSphere());
> BG.addChild(PosPath);
> /*----------------- Step 3
> ---------------------------------------------------*/
>
> BG.addChild(TG);
> TG.addChild(VP);
>
> BG.compile();
> return BG;
> }
>
> "Step1" : for translating and rotating the view coordinate
> "Step2" : for setting the "KeyNavigatorBehavior"
> "Step3" : for using "PositionPathInterpolator"
>
> Question1 :
> if I add "Step1" and "Step2" in my program and run it, the
> program is well --- it means that "Step1" and "Step2" are working
> together!!
> but when I add "Step1" and "Step3" in my program the
> program and run it, the result is :
> Initially, "Step1" is running, but when the "Step3" is
> running, the "Step1" isn't working ---
> it means that Step3 and Step1 aren't working together,
> "PosPath" is working at the original coordinate.
> how do I get it work together with "Step1" and "Step3" ?
>
> Question2 :
> the Constructor of PositionPathInterpolator is :
> Public PositionPathInterpolator(Alpha alpha,TransformGroup
> target,
> Transform3D
> axisOfTranslation,float[] knots,Point3f[] positions)
> What is the purpose of the "Transform3D axisOfTranslation"
> ?
> and How to give the value of "Transform3D
> axisOfTranslation" ?
>
> ===========================================================================
> 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".