|
![](/i/fill.gif) |
"Josh" <s### [at] a com> wrote in message news:4353cdf0$1@news.povray.org...
>> Any good?
>
> Sadly not. It does seem to be implementing a a sin value
>
> frame 1 = 0
> frame 10 = 749
> frame 100 = 108
> frame 150 = 893
>
> Thanks for trying. I couldn't even make a guess.
>
Hi Josh,
I should have pointed out that when you take the sine of the number, POV-Ray
uses Radians by default, so, for this formula you need to use the POV-Ray
sind() function which is in math.inc (I thought you were just missing the
underlying mathematics) .
Here's a sample piece of SDL that writes the results into the message
stream. It renders a blank scene, but if you look at the message stream it
shows the distance travelled increasing from -100 to 1095 in progressively
smaller steps.
#include "math.inc"
#local FrameCounter = 1;
#while (FrameCounter<151)
#local DistanceX = sind((FrameCounter-1)*90/149)*1195-100;
#debug concat("Frame Count: ",str(FrameCounter,3,3),"
DistanceX: ",str(DistanceX,3,3),"\n")
#local FrameCounter = FrameCounter + 1;
#end
In an animation you could also use a slightly simpler version using the
clock variable as follows:
DistanceX = sind(clock*90)*1195-100;
(because the clock variable passes from 0 to 1 by default when generating a
sequence of frames).
Hope that's better :-)
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |