POV-Ray : Newsgroups : povray.general : Math error Server Time
29 Jul 2024 18:24:56 EDT (-0400)
  Math error (Message 1 to 4 of 4)  
From: Anthony D  Baye
Subject: Math error
Date: 18 Sep 2010 02:05:01
Message: <web.4c945599cfc6a233507e8a090@news.povray.org>
I'm having trouble with a parameterized calculation in three forms

((T*P)/2)*pow((clock - index(Start))/index(Duration),2)

(P*T*T)*pow((clock - index(Start))/index(Duration),2)

and

T*P*( (clock - index(Start)) / index(Duration) )

index(T) is calculated by a macro which takes a 3d vector T
_TICK_ is defined in another macro.

#macro index(T)
     #local Seconds = T.x*3600 + T.y*60 * T.z;

     _TICK_*Seconds     // where _TICK_ is (final_clock - initial_clock) /
animLen
#end

I passed various elements of the calculation to a debug statement, and the
problem seems to arise in the (clock - index(I))/index(D) portion, the result
being that my Delta_T is about 10,000 times larger than it should be.

which shouldn't work

When I run the same calculation with set values as below

(5*1080/2)*pow((clock - 0)/index(5),2)

I get exactly what I should get, as confirmed by my pocket calculator with
various different values.

I have three files illustrating this problem in a zip file I'll upload to p.b.a

test.pov illustrates the solution that works while test3.pov illustrates the
problem

I've been rendering with the following command line:

+a0.03 +ki0.0 +kf1.0 +kfi1 +kff600 -D -GA

and encoding with mencoder at 60fps

any insight on this problem would be appreciated


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Math error
Date: 18 Sep 2010 02:23:12
Message: <4c945ad0$1@news.povray.org>
Anthony D. Baye wrote:
>      #local Seconds = T.x*3600 + T.y*60 * T.z;

	Shouldn't that be a "+" before "T.z"?

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

From: Anthony D  Baye
Subject: Re: Math error
Date: 18 Sep 2010 13:15:00
Message: <web.4c94f2ae50cc844d507e8a090@news.povray.org>
=?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger@free.fr> wrote:
> Anthony D. Baye wrote:
> >      #local Seconds = T.x*3600 + T.y*60 * T.z;
>
>  Shouldn't that be a "+" before "T.z"?
>
>   Jerome
> --
> mailto:jeb### [at] freefr
> http://jeberger.free.fr
> Jabber: jeb### [at] jabberfr

It's correct in the files.  Just a typo in the post.

A.D.B.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Math error
Date: 23 Sep 2010 00:10:01
Message: <web.4c9ad1be50cc844d507e8a090@news.povray.org>
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger@free.fr> wrote:
> > Anthony D. Baye wrote:
> > >      #local Seconds = T.x*3600 + T.y*60 * T.z;
> >
> >  Shouldn't that be a "+" before "T.z"?
> >
> >   Jerome
> > --
> > mailto:jeb### [at] freefr
> > http://jeberger.free.fr
> > Jabber: jeb### [at] jabberfr
>
> It's correct in the files.  Just a typo in the post.
>
> A.D.B.

It seems that the problem lay in the fact that the operations aren't precomputed
by the separate macros but, rather, dropped in to form a larger equation. The
result is that I had to parenthesize EVERYTHING in each macro, so that the
proper order of operations could be preserved.

It makes sense when I think about it.

the troublemaker line was in the eClock macro

_TICK_*Seconds

i changed it to (_TICK_*Seconds) and voila!
I also put encapsulating parentheses around each of the three formulae in Timer.

The Timer macro is now self-limiting and additive so that the line:

rotate (Timer(1, <0, 0, 0>, <0, 0, 5>, 1080) +
        Timer (3, <0, 0, 5>, <0, 0, 10>, 1080))*x

creates a timeline for rotation about the x axis where the first five seconds
are spent accelerating to 4 revs/sec and the last five are spent rotating at a
constant 4 revs/sec.

Comments?

A.D.B.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.