Attached file takes two sets of x,y,z co-ordinates and a Group and draws a
cylinder between the two locations. The math involved took me a few hours to
figure out. Some debug info is written to the console during execution. The
code there is part of a project I'm doing at University, and I'll make it
available on the web when I'm finished.
p.s. Sorry for top-posting, I'm stuck with Outlook here :-/

--
sandy

----- Original Message -----
From: "Daniel Selman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 07, 2002 1:54 PM
Subject: Re: [JAVA3D] creating cylinder between two points


> Russell,
>
> Check out the ScenegraphTest example from my book which does what you
> describe:
>
> /**
> * This example builds a basic hierarchical model of the
> * top part of a human torso (2 arms, neck and head).
> * the arms are built using a hierarchy of TransformGroups
> * with Cylinders used for the geometry itself.
> * RotationInterpolators are used to crudely animate the model.
> */
>
> Sincerely,
>
> Daniel Selman
>
> Author - "Java 3D Programming"
> http://www.manning.com/selman
>
>
>
> -----Original Message-----
> From: Discussion list for Java 3D API
> [mailto:[EMAIL PROTECTED]]On Behalf Of Russell Power
> Sent: Thursday, March 07, 2002 1:18 AM
> To: [EMAIL PROTECTED]
> Subject: creating cylinder between two points
>
>
> Hi,
>
> I'm having some trouble trying to figure out how to create a cylinder to
> connect two spheres together.  I can add everything to the scene
correctly,
> but the cylinder never seems to end up in the right spot.  I first tried
> something like:
>
> ...
>
> Vector3d cylStart = new Vector3d();
> cylStart.sub( start, end );
> cylStart.scale( 0.5f );
> cylStart.add(start);
>
> Transform3D cylTrans = new Transform3D();
> cylTrans.lookAt( cylStart, end, new Vector3d(0,1,0) );
>
> ...
>
> Where start and end are locations of the spheres.  This gave me a cylinder
> that was nowhere near where I needed it.  I also tried calculating the
three
> euler angles, and using setEuler and setTranslation, to no avail.  I also
> tried creating a quarternion using the axis and angle, but nothing seems
to
> want to work out.
>
> Any suggestions would be *much* appreciated.
>
> Thanks!
>
> --russell
>
>
===========================================================================
> 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".
>

Attachment: ChartJ3DLink.java
Description: java/

Reply via email to