POV-Ray : Newsgroups : povray.general : Need math help : Re: Need math help Server Time
10 Aug 2024 09:12:58 EDT (-0400)
  Re: Need math help  
From: John VanSickle
Date: 10 Mar 2000 22:38:39
Message: <38C9C23B.6CF9476C@erols.com>
Tor Olav Kristensen wrote:
> 
> John VanSickle wrote:
> 
> > I avoided using the trig functions.  I also made local copies of the
> > arguments, so that if the user passes an expression as one of the arguments,
> > that expression will be evaluated.
> 
> Will this also make it parse faster?

That depends on how much faster a label look-up is compared to the evaluation
of an expression.  Most of the time a single variable or a constant is being
passed.

> What if one uses () around the passed arguments when one uses them
> in i.e. multiplications and divisions?

Same effect.

> And if so, would it be sufficient to do this in the cone statement in the last
> torus-connect macro i posted?
> 
> Like this:
> cone { (SMiR)*i*j+SP,(SMiR)*h+SMaR,((EMiR)*i+f)*j+SP,(EMiR)*h+EMaR }
> 
> () around SMiR and  EMiR ...

Yes, the parentheses force evaluation of the argument so that expressions
can be passed without causing an error.  This is important if you are going
to had it out for other people to use.

> By the way: Did you recognize any of the math in that macro?

It appears to be the same calculations as what I posted, although I may
have taken an unnecessary root here or there.  I used long labels as the
arguments in the sample code so that people could tell which argument to
the macro was supposed to be the start point, the end point, etc., without
having to puzzle out the acronyms.  In a real .INC file I use shorter
labels that follow the naming coventions I use in all of my scene code.

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

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