To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10336
10335  |  10337
Subject: 
Re: Tweening (and some Backwards Engineering)
Newsgroups: 
lugnet.cad.dev
Date: 
Sat, 12 Nov 2005 00:17:19 GMT
Viewed: 
3703 times
  
In lugnet.cad.dev, Tore Eriksson wrote:
I've been thinking a little about Tweening the last two weeks.
Linear Motion Tweening between two keyframes is very simple I guess.
If x(0)=50 and x(1)=250, then x(0.1)=50+(250-50)*0.1=70. "kx+m".

But then I came to the rest of the LDraw Type 1 Line. Those variables I call 'a'
though 'i'.
1 c  x y z  a b c  d e f  g h i  object.dat

For example: let's say this is a door i closed position. pos(0)
1 16  0 0 0  1 0 0  0 1 0  0 0 1  door.ldr
And here it is wide open, pos(1):
1 16  0 0 0  -0.174 0 0.985  0 1 0  -0.985 0 -0.174  door.ldr

Now, I can't just take the difference between a(0) and a(1) and divide it into
the number of frames I wish to use to open the door. I need to calculate the
angles at pos(0) and pos(1) and then the difference between them. (I know it's
100 degress, because I can easily rotate an object in the LDraw matrix). But I
don't know how to engineer it backwards. How will I make a program aware of that
in this case the difference between the y-axis rotation is 100 degrees?

And to make it more complicated: it has to recognize x and z rotation as well -
in the same tweening.

And, even more complicated than that. The object may be a stretched or sqeezed
(elastic [rubber] objects or as comical animation effects)

When this difference between angles is calculated, I think it's easy to create a
Linear Rotation Tweening.

Now, I need help to find the formulas to calculate the rotation angles from the
LDraw matrix. I think the output will be:
At pos(0) 0 0 0
At pos(1) 0 260 0
But how do I get there...?


/Tore


Hi Tore,

Finding the angles is quite complicated and depends on the choice of how you
express the angles. The main way of expressing an angle are Euler angles
(http://en.wikipedia.org/wiki/Euler_angles) however there is another way to
express angles which is slightly more mathematically 'sound' called SO(3)
rotation groups and their associated so(3) vectors.

What a rotation matrix corresponds to is, in some sense, a way of converting a 3
element vector (Euler angles or so(3) vectors) into a matrix. The inversion is,
of course, also possible, but, is not so straightfoward as it is not unique
(especially for Euler angles).

The trick is probably to look up on google a routine for converting a rotation
matrix to a set of Euler angles and then fitting the three angles and using that
trio to form new rotation matrices along the way. I would seriously suggest
looking up a routine rather than trying to write one yourself as the are really
quite complicated once you have to take into account the inversions of trig
functions as well as the special cases.

That said, I have some written in Matlab that aren't fully debugged but I can
finish debugging them/look up a debugged algorithm. These, of course, can then
be rewritten in any language.

If you would like to know more, drop me an email and I can send you some files
and other stuff I have written and obtained for my work.

Tim



Message is in Reply To:
  Tweening (and some Backwards Engineering)
 
I've been thinking a little about Tweening the last two weeks. Linear Motion Tweening between two keyframes is very simple I guess. If x(0)=50 and x(1)=250, then x(0.1)=50+(250-50)*0.1=70. "kx+m". But then I came to the rest of the LDraw Type 1 (...) (19 years ago, 11-Nov-05, to lugnet.cad.dev)

30 Messages in This Thread:







Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR