Special:
|
[DAT] (requires LDraw-compatible viewer)
|
Subject:
|
Re: HELP !!! Rotating a cylinder
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Fri, 8 Sep 2000 22:38:09 GMT
|
Viewed:
|
802 times
|
| |
| |
OK, here is what I came up with:
2 24 14.8 -16.4 6.1 16.8 -5 6.1
4 16 14.8 -16.4 6.1 16.8 -5 6.1 16.8 -5 -6.1 14.8 -16.4 -6.1
1 14 21.2 -11.2 0 0.547 -3.102 0 3.102 0.547 0 0 0 3.15 8-8SPHE.DAT
1 14 21.2 -11.2 0 0.379 -5.909 0 2.147 1.044 0 0 0 2.18 4-4CYLI.DAT
0
A few things to note. First of all, I replace your two half-spheres with a
single full sphere. Second, the cylinder continues on to the center of the
sphere. Now, for how I produced the numbers. I started with the cylinder
and sphere set up just like I wanted them, but both aligned with the Y axis,
which was very straightforward. I made the cylinder with radius 2.18 and
length 6, with the center of one of the circular ends at the center of the
sphere. This produced the following two lines:
1 14 21.2 -11.2 0 3.15 0 0 0 3.15 0 0 0 3.15 8-8SPHE.DAT
1 14 21.1 -11.2 0 2.18 0 0 0 6 0 0 0 2.18 4-4CYLI.DAT
Next, I determined that your plane was approximately 10 degrees off the Y
axis. (Based on rounding, I assume you meant it to be exactly 80 degrees.
If you really meant for it to be the 80.05 degrees that it actually is,
you'll have to redo the calculations I'm about to describe.) To line up the
cylinder and sphere perpendicular to this required a rotation of 80 degrees
around the Z axis.
This is accomplished by multiplying the existing matrices by a rotation
matrix. First, I'll describe the rotation matrix. A rotation matrix around
the Z axis is described as:
cos(Theta) sin(Theta) 0 0
-sin(Theta) cos(Theta) 0 0
0 0 1 0
0 0 0 1
So, since Theta in this case is 80 degrees, this produces the following
matrix:
0.1736 0.9848 0.0000 0.0000
-0.9848 0.1736 0.0000 0.0000
0.0000 0.0000 1.0000 0.0000
0.0000 0.0000 0.0000 1.0000
If you want to use 80.05 degrees, you'll have to recompute this matrix.
Make sure to do your sines and cosines in degrees, or convert 80.05 to
radians.
To get the final results, we simply multiple the to matrices we had above by
this rotation matrix. The data in the line in the dat file is not encoded
directly as a matrix, but it is straightforwad. For a given line of the
form:
4 12 X Y Z A B C D E F G H I BLAH.DAT
You get the following matrix:
A D G X
B E H Y
C F I Z
0 0 1 1
(Note the fact that letters are vertically oriented.)
So, to apply the rotation to the cylinder, you do this:
| 2.180 0.000 0.000 21.200|
| 0.000 6.000 0.000 -11.200|
| 0.000 0.000 2.180 0.000|
| 0.000 0.000 0.000 1.000|
X
| 0.174 0.985 0.000 0.000|
| -0.985 0.174 0.000 0.000|
| 0.000 0.000 1.000 0.000|
| 0.000 0.000 0.000 1.000|
=
| 0.379 2.147 0.000 21.200|
| -5.909 1.044 0.000 -11.200|
| 0.000 0.000 2.180 0.000|
| 0.000 0.000 0.000 1.000|
You then reverse the mapping out of this matrix and back into the DAT file
line. If you want to make any changes, you will need to redo the above
calculations. If you have LDAO, it sounds like you can have it perform the
calculations for you. If you don't know/remember your matrix math, I found
an online Java matrix calculator applet at:
http://www.mkaz.com/math/matrix.html
(In fact, this is what I used to do the matrix calculations, since my HP
calculator with built-in matrix math is at home.) You may want to adjust
the length of the cylinder; do this at the beginning and then re-do the
matrix multiplications. I hope this helps.
--Travis Cobbs (tcobbs@san.REMOVE.rr.com)
"Dennis Osborn" <osbodr01@holmes.ipfw.edu> wrote in message
news:G0KtFp.2KL@lugnet.com...
> In lugnet.cad, Travis Cobbs writes:
> >
> > As for lining the two up, I would suggest to first line them up
> > axis-aligned, and then multiply both matrices by a rotation matrix that
> > rotates about the shoulder. Or, if the sphere is positioned just the way
> > you want it, then rotate about the center of the sphere. Do you know how to
> > do this?
>
> no
>
> > If not, get it lined up along some axis, and then post what you
> > have, along with how exactly you want it rotated, and I'll post the rotated
> > version, along with notes on how I produced it.
> >
> > --Travis Cobbs (tcobbs@san.REMOVE.rr.com)
>
>
> 2 24 14.8 -16.4 6.1 16.8 -5 6.1
> 4 16 14.8 -16.4 6.1 16.8 -5 6.1 16.8 -5 -6.1 14.8 -16.4 -6.1
> 1 14 21.2 -11.2 0 3.15 0 0 0 3.15 0 0 0 3.15 4-8SPHE.DAT
> 1 14 21.2 -11.2 0 3.15 0 0 0 -3.15 0 0 0 -3.15 4-8SPHE.DAT
> 0
>
> Travis, I need a cylider, radius 2.8, with a center line perpendicular to the
> shoulder plane going from the plane to the center of the sphere. I hope this
> is enough information.
>
> I will not be online until next Monday. I hope you can help me.
> Thanks, Dennis
|
|
Message has 1 Reply: | | Re: HELP !!! Rotating a cylinder
|
| Travis, I want to thank you for your help and the explaination on the rotation matrix. You can see the results in the Skeleton Torso I am about to post. I have documented your help in the file. Once again, Thanks. Dennis (24 years ago, 11-Sep-00, to lugnet.cad.dev)
|
Message is in Reply To:
| | Re: HELP !!! Rotating a cylinder [DAT]
|
| (...) no (...) 2 24 14.8 -16.4 6.1 16.8 -5 6.1 4 16 14.8 -16.4 6.1 16.8 -5 6.1 16.8 -5 -6.1 14.8 -16.4 -6.1 1 14 21.2 -11.2 0 3.15 0 0 0 3.15 0 0 0 3.15 4-8SPHE.DAT 1 14 21.2 -11.2 0 3.15 0 0 0 -3.15 0 0 0 -3.15 4-8SPHE.DAT 0 Travis, I need a (...) (24 years ago, 8-Sep-00, to lugnet.cad)
|
9 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|