POV-Ray : Newsgroups : povray.unofficial.patches : #declares and memory management : Re: #declares and memory management Server Time
18 Aug 2024 12:25:57 EDT (-0400)
  Re: #declares and memory management  
From: Warp
Date: 21 May 2001 07:49:30
Message: <3b0900c9@news.povray.org>
Lutz-Peter Hooge <lpv### [at] gmxde> wrote:
: Why isn't this possible with all objects, like a union of 10000 cones for 
: example?

  Most objects are optimized when certain transformations are applied to
them (in order to eliminate those transformations).
  For example, if you have this:

#declare MySphere = sphere { 0,1 }

object { MySphere scale 10 translate x*20 }
object { Mysphere translate -x*20 }

the result will be internally exactly the same as if you had written:

sphere { x*20, 10 }
sphere { -x*20, 1 }

  The idea is to eliminate the transformations where possible and thus
speed up the rendering. When the ray doesn't have to be transformed, the
intersection test will be faster.
  This same optimization is applied to objects inside CSG groups.
  This is why declared CSG groups can't be used as they are, but they have
to be copied in order to perform the optimizations to the copy.

  This is what I have understood. I might be wrong in some details.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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