POV-Ray : Newsgroups : povray.pov4.discussion.general : True objects in SDL? : Re: True objects in SDL? Server Time
5 May 2024 01:59:59 EDT (-0400)
  Re: True objects in SDL?  
From: Nicolas Alvarez
Date: 3 Feb 2008 09:57:52
Message: <47a5d670$1@news.povray.org>
Both properties and methods. Unions should have an add_object method :)

Now:
union {
     #while(I<10)
         sphere { x*I, 0.1 }
         #declare I=I+1;
     #end
}

Or, in loops which have things much more complex than that (for example 
if you need to trace() all the created spheres in order to create one more):

#declare Obj = union{};
#while(I<10)
     #declare Obj = union { object{Obj} sphere { x*I, 0.1 } };
     #declare I=I+1;
#end

(I heard POV-Ray has a special optimization for this, to make the final 
in-memory CSG be a flat union like from the first example, instead of a 
nested union)

So I'd like:

obj = union{};
while(I<10) {
     obj.add(sphere { x*I, 0.1 });
     I++;
}

(I'm not suggesting this script syntax, just the concept of adding 
objects to already-created CSG structures)


Post a reply to this message

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