POV-Ray : Newsgroups : povray.general : piles of gold coins Server Time
1 Aug 2024 14:32:12 EDT (-0400)
  piles of gold coins (Message 1 to 7 of 7)  
From: Barehunter
Subject: piles of gold coins
Date: 4 Sep 2005 15:10:01
Message: <web.431b464b2d8da3f37e0a37430@news.povray.org>
Ok I am doing a series of pic involving dragons. Now I came to the part in
the script when I need to do a dragon den with piles of gold coins
everywhere. Obviously making a coin is easy. but is there an easier way to
make piles of coins without typing out a thousand cylinders?


Post a reply to this message

From: Florian Brucker
Subject: Re: piles of gold coins
Date: 4 Sep 2005 18:08:40
Message: <431b7068$1@news.povray.org>
> Ok I am doing a series of pic involving dragons. Now I came to the part in
> the script when I need to do a dragon den with piles of gold coins
> everywhere. Obviously making a coin is easy. but is there an easier way to
> make piles of coins without typing out a thousand cylinders?

There are two possible solutions to calculate the placement of the coins:

1. A simulation system (e.g. MechSim): Could be hard to setup, could 
take long to calculate, but will give you very good results, even for 
close-ups.

2. Some sort of distribution algorithm. Difficulty goes from very easy 
to almost impossible, I guess, same goes for calculation time and 
quality of the result. If you don't need close-ups, you're probably 
better off with this solution, because you won't see the intersections then.


HTH,
Florian


Post a reply to this message

From: Gilles Tran
Subject: Re: piles of gold coins
Date: 4 Sep 2005 18:31:46
Message: <431b75d2$1@news.povray.org>

web.431b464b2d8da3f37e0a37430@news.povray.org...
> Ok I am doing a series of pic involving dragons. Now I came to the part in
> the script when I need to do a dragon den with piles of gold coins
> everywhere. Obviously making a coin is easy. but is there an easier way to
> make piles of coins without typing out a thousand cylinders?

Look for the demo files in the "advanced/blocks" directory in the 
distribution. There's code to do that with cubes but it could be adapted to 
cylinders.

G.


Post a reply to this message

From: Barehunter
Subject: Re: piles of gold coins
Date: 4 Sep 2005 20:45:00
Message: <web.431b948f62b52bbd553c29380@news.povray.org>
"Gilles Tran" <gitran_nospam_@wanadoo.fr> wrote:
> Look for the demo files in the "advanced/blocks" directory in the
> distribution. There's code to do that with cubes but it could be adapted to
> cylinders.
>
> G.

possibly. I look ed the files and my eyes crossed. They are way too advanced
for me to figure out let alone tinker with.


Post a reply to this message

From: Barehunter
Subject: Re: piles of gold coins
Date: 4 Sep 2005 21:05:01
Message: <web.431b98c462b52bbd553c29380@news.povray.org>
I think I found a way to do it. I made a series of the following,
successvely narrowing the outer radius as it went up in increments of the
thickness of the coin.

#declare coincount =0;
#while(coincount < 50)

cylinder{<0,0,0>,<0,0,-0.125>,.4375
 texture{T_Gold_4E}
 translate<0,7,0>
 rotate<0,0,3.583322>
 rotate<0,0,-(coincount * 7.166644)>
 }
 #declare coincount = coincount +1;
#end

ending up with a single coin on top. then I threw a cone underneath it all
to catch the gaps.( heh this is my very first use of #while :)  )


Post a reply to this message

From: Skip Talbot
Subject: Re: piles of gold coins
Date: 18 Sep 2005 15:56:12
Message: <432dc65c@news.povray.org>
I assume you are using many while loops, one for each layer?  You could 
embed another while loop so that the entire pile is made.  A little more 
math for you to figure out, but it still shouldn't be as complicated as 
the advanced macros the others have suggested.

You could also make some tall vertical stacks of coins too.  Throw in 
another while with your cylinders and just translate them up with the 
count variable.  You could also add a random translate in the x and z 
directions so they don't perfectly line up as they go up too.  Crazy, 
leaning stacks of coins with pyramid piles would look pretty neat.

Skip


Post a reply to this message

From: Kenneth
Subject: Re: piles of gold coins
Date: 4 Oct 2005 14:10:01
Message: <web.4342c54662b52bbd55cad30e0@news.povray.org>
You might also use the TRACE operation (which happens to be one of my own
favorite POV features.)  You could randomly place thousands of coins on,
for example, a little heightfield "mound," while using the NORMALS that are
found during the trace operation to tilt the coins so that they follow the
contours of the mound. ( I'm simplyfying a somewhat complex
process...sorry!) With enough overlapping coins, the mound shape itself
would not be visible. This probably wouldn't work for closeups, though,
without some kind of "collision detection" to keep coins from simply
"melting into" each other. But I've used just the technique described here
to cover a treetrunk with lots of overlapping ivy leaves, and it looks
QUITE good, even in closeup.


Post a reply to this message

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