POV-Ray : Newsgroups : povray.unix : Pentium 3 optimized binary : Re: Pentium 3 optimized binary Server Time
28 Jul 2024 16:29:18 EDT (-0400)
  Re: Pentium 3 optimized binary  
From: Micha Riser
Date: 3 Aug 2002 03:49:01
Message: <3d4b8aec@news.povray.org>
> return Sqr((sin(EPoint[X]) + sin(EPoint[Y] + sin(EPoint[Z])))/3.0);

You probably mean  Sqr((sin(EPoint[X])+sin(EPoint[Y])+sin(EPoint[Z]))/3);

Temporary variables are do not affect the performance mostly though. The 
has to use several registers anyways. But to show the vector nature of this 
calculation it should be written as:

DBL value=0;
for(int i=0; i<3; i++) value+=sin(EPoint[i]);
return Sqr(value/3.0);

Of course this assumes that X,Y,Z are 0-2 index. 
 

-- 
http://objects.povworld.org - the POV-Ray Objects Collection


Post a reply to this message

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