POV-Ray : Newsgroups : povray.general : Macros Server Time
12 Aug 2024 17:12:37 EDT (-0400)
  Macros (Message 1 to 2 of 2)  
From: Mike Metheny
Subject: Macros
Date: 3 Feb 1999 02:29:40
Message: <36b7fae4.0@news.povray.org>
I've never done anything with macros; but I'm about to start learning I
think. . .I was wondering if you guys could give me some general ideas as to
how to create a pile of pebbles or something;  you know wide at the base and
sort of triangularly tapering towards a dull top like poured sand?  Say I
used spheres or some other object as my pebble; but wanted them (obviously)
to not collide and what not.



Mike Metheny
lon### [at] vtedu
http://loneshepherd.ml.org/

"When one's words are no better than silence, one should keep silent."


Post a reply to this message

From: Spider
Subject: Re: Macros
Date: 3 Feb 1999 20:50:13
Message: <36B8FBAE.DB83A451@bahnhof.se>
Start by doing a general while loop for it, something like :

#declare Numx = 10;
#declare Numy = 10;
#declare Numz = 10;
#declare Ny =0;
#while(Ny<Numy)
  #declare Nx =0;
  #while(Nx<Numx)
    #declare Nz=0;
    #while(Nz<Numz)
      sphere { <0,0,0>,1 pigment { White } translate
<-0.5*Nx,Ny,-0.5*Nz> }
      #declare Nz=Nz+1;
    #end
    #declare Nx=Nx+1;
  #end
  #declare Ny=Ny+1;
  #declare Numz=Numz-1;
  #declare Numx=Numx-1;
#end
and then when the loop works something resembling what you want, you
change the indata variables for the start parameters of a #macro, like
#macro place(Numx,Numy,Numz)
<insert code>
#end

Then ytou change it until it fits. in this case I'd make Num as a
vector, and use Num.x, num.y, Num.z in the macro...

Hope it helps.

note : This code is untested and is probably not what you were after.

//Spider


Post a reply to this message

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