POV-Ray : Newsgroups : povray.general : Field of View : Re: Field of View Server Time
7 Aug 2024 17:21:20 EDT (-0400)
  Re: Field of View  
From: Chris Huff
Date: 5 Aug 2001 20:28:29
Message: <chrishuff-5EF29D.19260005082001@netplex.aussie.org>
In article <3b6de1fb@news.povray.org>,
 "Vadim Sytnikov" <syt### [at] rucom> wrote:

> Using pow() in this context is a bad idea. Simple
> multiplication (e.g. len3*len3) will do the trick while
> being more efficient. Not by far due to the huge
> parsing overhead, but...

Actually, len3*len3 might be slower...more stuff to parse, and the time 
it takes to call the C pow() function is insignificant compared to the 
time it takes to parse POV code. But speed is very unlikely to be of any 
concern here, readability is better, try this:
#macro Sqr(V) (V*V) #end

Sqr(Len3)


BTW, it is a good idea to always include at least one capital letter in 
your macro or variable identifiers...what if some future version of POV 
added len1, len2, or vangle() keywords? This code would simply fail.

-- 
Christopher James Huff - chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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