Yeah.... I'm not getting it. How many Quaternions will you have? Do you build one for each axis (x,y,z)? Once you have them, how do you get them all into a Transform3D so I can transform the original points into my new system?
Let's use an example. two points - p1 = 50,75,50 (upper left of rectangular plane) and p2 = 75,50,75 (lower right of rectangular plane) the middle point (exact center of plane) is mid_p = 62.5,62.5,62.5 I want this plane to be translated/rotated to the x,y planes. Thanks, Michael -----Original Message----- From: Artur Biesiadowski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 1:08 PM To: [EMAIL PROTECTED] Subject: Re: [JAVA3D] newbie question Michael Newcomb wrote: > Think the earth. I've got two points on the Earth, the upper left and lower > right of a rectangle (think square, not box). Now those two points lie on a > plane. I know which plane because a vector from the center of the earth > (0,0,0) to the center of the square is perpendicular to this plane. Now, > all I want to do is translate and rotate the square to the origin so I can > work on it as if its center was at 0,0,0. Then, I want to translate and > rotate it back to the original position. > > How do I do that using matrices.... You don't have to rotate. Compute center of rectangle, translate vertices by vector being it's negative coordinates - you have a rectangle centered at 0,0,0. Now do what you want and then translate all vertices back - using original vector (positive this time), not the new one of course. Unless you want to have rectangle laying flat on, for example, XZ plane, with it's sides aligned to X and Z axis... Then it is a bit tricky. Thing to remember is that when you transform object in one direction, inverse transform will take you back. In this case, it is easiest to ask yourself how to transform aligned, centered rectangle/object to your 'starting' position and then use inverted transform first. First determine translation - it is easiest. Let's call it vector m. Then create quatertion which describes you base orientation - for example 'up' being Y axis, looking straight ahead in Z axis, with right hand pointed in X axis (please make sure that you will get positive/negative directions right and use it for your entire applications consitently) (quat qbase). Then construct quaterion corresponding to your target orientation (AxisAngle probably can be helpful for you here) (quat qtarget). Now find quaterion which means transforming from base to target orientation (I think that you have to multiply qtarget with inverse of qbase - somebody please correct me if I'm wrong) = qt. Transform from base to target can be constructed from (m,qt,1). Last one is scale. So inverse of this transform will take your rectangle back to origin, then play with it and then apply transform itself. I hope I got it right. Artur =========================================================================== 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".