Hi
When you use this method to construct the axisangle with two arbitrary
vectors, I've found that sometimes the rotation angle will not be the
correct one. For example, suppose you have two unit vectors, one along the
positive x-axis (v1) and one along the positive y-axis (v2). I wish to find
the transform that will turn v1 into v2. When you find the angle it will
always be PI/2. However, depending on the order you put the vectors,
(v1.cross(v2) or v2.cross(v1)) the axis for your rotation will either be a
unit vector on the positive z-axis, or a unit vector along the negative
z-axis. In the first case, the angle should be PI/2, but in the second case
the angle should be -PI/2.
Is there a way to determine the proper axis-angle set for two arbitrary
vectors? the way I do it now is to simply build the transform3ds and check
to see which will transform the vector correctly, and im sure there is a
more efficient way to do it.

Thanks
-Bob Dengle

>From: Fred Klingener <[EMAIL PROTECTED]>
>Reply-To: Fred Klingener <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: [JAVA3D] Rotations
>Date: Tue, 5 Mar 2002 09:44:46 -0500
>
>From: Asaf Dafner
>Sent: Tuesday, March 05, 2002 2:11 AM
>
> > More specifically about rotations (or is it the math that i'm missing?):
> > I want to position a cylinder by using a function that receives two
>(x,y,z) points,
> > (so the cylinder is like a line stretching between these points).
> > Can anyone please provide some pointers/link/source extracts that would
>help me?
>
>1. Points are P1 and P2
>2. length of cylinder L = |P2 - P1|
>3. desired unit vector along axis of cylinder V = (P2 - P1)/L
>4. midpoint of line M = (P1 + P2)/2
>
>5. Construct cylinder Shape3D cyl = new Shape3D . . .
>I forget what axis the Java 3D primitive Cylinder lines up on, say it's the
>X-axis, X.
>
>6. Find rotation angle R = arccos(V dot X)
>7. Find rotation axis   S = X cross V; S = S/|S|
>
>8. Construct translation Transform3D using midpoint M
>9. Construct rotation Transform3D using axis S and angle R
>10. Multiply them (R*M) and make a TransformGroup from the result.
>
>hth,
>Fred Klingener
>
>
>
>Thanks,
>Asaf.
>
>"Áö±Ô¼±" wrote:
>  JeeGS> Hello...I am trying to obtain the same infomation as you are
>trying
>.....Can I get the same source code that you obtain?
>Thanks a lot...
>
>
>
> > Hi all,
> > I am rotating an object on the screen. It seems
> > to be rotating in a circular path, instead of rotating
> > on its own axis.
> >
> > In OpenGl, we can correct it by translating the object
> > to the origin and then apply transformations, and
> > again retranslate the object to its original place.
> >
> > Is this the way to do in Java3D. Can anyone give a
> > sample code.
> >
> > Thanks,
> > Sagar.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - sign up for Fantasy Baseball
> > http://sports.yahoo.com
> >
> >
>===========================================================================
> > 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".
> >
>
>____________________________________________________________________________
>Çѹ̸£¿¡¼­ ¹«·á À̸ÞÀÏÀ» ¹ÞÀ¸¼¼¿ä (http://mail.hanmir.com/)
>¿ì¸®³¢¸® ÅëÇÏ´Â ÀÎÅÍ³Ý ¾ÆÁöÆ® Çѹ̸£ (http://www.hanmir.com/)
>
>
>===========================================================================
>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".
>--
>-------------------------------------------------
>Asaf Dafner        Short -but- Deep, Mainly Deep.
>Frontline PCB Solutions
>Phone : (972) 8-9322183 Ext. 148
>Fax   : (972) 8-9322186
>email : [EMAIL PROTECTED]
>
>
>Je n'ai fait celle-ci plus longue que parce que
>je n'ai pas eu le loisir de la faire plus courte.
>                                  - Pascal
>
>===========================================================================
>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".




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

===========================================================================
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