I think that this problem results from two aspects: one is how to position
the cylinder, the other is how to rotate your cylinder. The first one is
easy to solve, this point should be the center of the two spheres. The
second one, I think you should use AxisAngle4f object or use the custom
rotation class (I developed it). In particular, if the two points align
parallel to x-axis, y-axis or z-axis, the result will be simple, you just
use the Matrix3f to solve it.

Rgds,

Cheng Chang Dong
http://vlab.ee.nus.edu.sg/~ccd

----- Original Message -----
From: "Russell Power" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 07, 2002 4:17 PM
Subject: [JAVA3D] 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".

Reply via email to