|
 |
"S I R ?" <fra### [at] jaliscoedu mx> wrote:
> kurtz le pirate <kur### [at] free fr> wrote:
> > // 50 degrees -> +/- 25 deg or something else, of course
> > #declare Amplitude = 50;
> > #declare HalfAmplitude = Amplitude*0.50;
You want the pendulum to swing over a certain amount on both sides.
kurtz defines the included angle as "Amplitude" and then takes half of that as
the amount it swings to either side.
> > Object to animate is "Object"
> >
> > object {
> > Object
So now he places the Object in the scene, and to rotate it in the animation, he
creates an equation using the clock variable.
if you point at your screen, your arm an finger are in the direction of the z
axis. So rotating around z rotates things in the plane of your screen.
By how much?
Well the max is "HalfAmlitude".
And we want to go from 0 to HalfAmplitude to 0 to -HalfAmplitude to 0 to .....
A circle is 2*pi radians around in angular units. (tau = 2*pi)
plotting sin on a unit circle goes from 0 to 1 to 0 to -1 to 0 to ....
So as the clock variable increases from 0 to 1, we take that and multiply it by
tau. That gives us a value that goes from 0 to tau.
Taking the sin of that gives us a value that goes from 0 to 1 to 0 to -1 to 0 to
.....
then multiplying that by HalfAmplitude gives us a value that goes from 0 to
HalfAmplitude to 0 to -HalfAmplitude to 0 to .....
and of course we need a vector to pass to "rotate", and so we multiply by z
> > rotate sin(clock*tau)*HalfAmplitude*z
> > }
> >
> > 'clock' from 0.0 to 1.0
Post a reply to this message
|
 |