POV-Ray : Newsgroups : povray.general : Pile of sticks? Server Time
4 Aug 2024 00:28:59 EDT (-0400)
  Pile of sticks? (Message 1 to 8 of 8)  
From: -s0da-
Subject: Pile of sticks?
Date: 30 Sep 2003 16:14:39
Message: <3f79e42f$1@news.povray.org>
Anyone got a good algorithm that'll create a pile of sticks?
much like you'd find in a small fire?

I have an idea, but can't seem to avoid intersections.  i.e.
dont' really want sticks that are going THROUGH each
other.  like to take into account that part of one stick can't
occupy the same space as another.

Any help pointing me in the right direction would be greatly
appreciated.


Post a reply to this message

From: JC (Exether)
Subject: Re: Pile of sticks?
Date: 1 Oct 2003 03:00:13
Message: <3f7a7b7d$1@news.povray.org>
I have exactly the same problem, I posted an equivalent message on 
09/15/2003 18:08 same forum. I've tried to use approximation algorithms, 
but avoiding coincidence is really a problem. When I manage to avoid 
coincidence, the sticks have big gaps between them and the pile doesn't 
really look like a pile. I ended up trying the MegaPOV mechsim 
functionalities, but they tend to take ages (it's still running at the 
moment I write this message), and I think it's a bit overkill. But maybe 
I just need to find the proper parameters for my purpose as I don't need 
an accurate movement, but only an accurate final state.

Yesterday I wrote a macro wich could be improved further and which 
performs not too bad. It's something like :

#local My_Seed = seed(0);

#declare F_Profil =function (Rayon_Max, hmax, h) { 
min(sin(pi*(1-h/hmax)/2)*(1.4*Rayon_Max), Rayon_Max) }

// ------------------------------------------------
#macro Tas (obj, Mrayon, Nrangee)

#local A=min_extent (obj);
#local B=max_extent (obj);
#local longueur=B.x-A.x;
#local rayon=(B.y-A.y)/2;

#debug concat ("longueur = ", str (longueur, 0, 2), "    rayon = ", str 
(rayon, 0, 2), "\n")

#local compteur=0;

#local j = 0;
#while (j < Nrangee)
   #local xp = -F_Profil (Mrayon, Nrangee, j);
   #while (xp < F_Profil (Mrayon, Nrangee, j))
     object {
       Vobj
       rotate 90*y + <rand(My_Seed), rand(My_Seed), rand(My_Seed)>*10
       translate
       <xp,
       rayon*(1+2*j)*0.3,
       2*sqrt(1 - pow(xp/Mrayon, 2))*(rand(My_Seed)-0.5)*F_Profil 
(Mrayon, Nrangee, j) >
       rotate <0,360*rand(My_Seed),0>
     }
     #local xp = xp + 0.8*rayon*2;
     #local compteur=compteur+1;
   #end
   #local j = j + 1;
#end
#debug concat ("nombre d'objets = ", str (compteur, 0, 2), "\n")
#end

#declare Vobj=object { ... whatever }

union { Tas (Vobj, 5, 35) }
cylinder { <0,-0.1,0>, <0, 0,0>, 5 pigment { rgb <0.8,0.5,0.5> } }


But i'm still interested by a real solution. That's for my IRTC entry, 
so I still a month to figure it out.

JC

-s0da- wrote:
> Anyone got a good algorithm that'll create a pile of sticks?
> much like you'd find in a small fire?
> 
> I have an idea, but can't seem to avoid intersections.  i.e.
> dont' really want sticks that are going THROUGH each
> other.  like to take into account that part of one stick can't
> occupy the same space as another.
> 
> Any help pointing me in the right direction would be greatly
> appreciated.


Post a reply to this message

From: -s0da-
Subject: Re: Pile of sticks?
Date: 2 Oct 2003 14:38:36
Message: <3f7c70ac@news.povray.org>
Anyone else have any ideas on this?

This has to be a pretty common problem, right?

apply it to a pile of marbles, or a pile of books,
or a toy box.

Is it simply a matter of just placing each one individually?

"-s0da-" <ske### [at] msncom> wrote in message
news:3f79e42f$1@news.povray.org...
> Anyone got a good algorithm that'll create a pile of sticks?
> much like you'd find in a small fire?
>
> I have an idea, but can't seem to avoid intersections.  i.e.
> dont' really want sticks that are going THROUGH each
> other.  like to take into account that part of one stick can't
> occupy the same space as another.
>
> Any help pointing me in the right direction would be greatly
> appreciated.
>
>


Post a reply to this message

From: Remco de Korte
Subject: Re: Pile of sticks?
Date: 2 Oct 2003 17:52:20
Message: <3F7C9D8B.134C3F5F@onwijs.com>
-s0da- wrote:
> 
> Anyone else have any ideas on this?
> 
> This has to be a pretty common problem, right?
> 
> apply it to a pile of marbles, or a pile of books,
> or a toy box.
> 
> Is it simply a matter of just placing each one individually?
> 
That was my first reaction, and my second and I still concur :)
I think for some problems (like this one) trying to create an automated
process (macro or whatever) will be overkill. Unless of course someone
does come up with a fairly simple, elegant and robust solution.
Of course if you want to stack hundreds of sticks that wouldn't work,
but then a macro needn't be perfect because who would see the small
errors?

Just my thoughts....

Re
mco


Post a reply to this message

From: -s0da-
Subject: Re: Pile of sticks?
Date: 2 Oct 2003 18:22:57
Message: <3f7ca541$1@news.povray.org>
well...what I'm actually trying to do is simulate brush laying
in a metal torch type frame.

So I guess detail wouldn't matter...I could probalby even
just make a good enough texture/material that might work,
as the flame will probably cancel out any detail of the sticks
anyways.

just wonderin' if someone else had already come up with
(as you put it) some simple, elegant solution already.

"Remco de Korte" <rem### [at] onwijscom> wrote in message
news:3F7C9D8B.134C3F5F@onwijs.com...
> -s0da- wrote:
> >
> > Anyone else have any ideas on this?
> >
> > This has to be a pretty common problem, right?
> >
> > apply it to a pile of marbles, or a pile of books,
> > or a toy box.
> >
> > Is it simply a matter of just placing each one individually?
> >
> That was my first reaction, and my second and I still concur :)
> I think for some problems (like this one) trying to create an automated
> process (macro or whatever) will be overkill. Unless of course someone
> does come up with a fairly simple, elegant and robust solution.
> Of course if you want to stack hundreds of sticks that wouldn't work,
> but then a macro needn't be perfect because who would see the small
> errors?
>
> Just my thoughts....
>
> Re
> mco


Post a reply to this message

From: Remco de Korte
Subject: Re: Pile of sticks?
Date: 2 Oct 2003 19:39:48
Message: <3F7CB6BC.D5AFD70E@onwijs.com>
-s0da- wrote:
> 
> well...what I'm actually trying to do is simulate brush laying
> in a metal torch type frame.
> 
> So I guess detail wouldn't matter...I could probalby even
> just make a good enough texture/material that might work,
> as the flame will probably cancel out any detail of the sticks
> anyways.
> 
> just wonderin' if someone else had already come up with
> (as you put it) some simple, elegant solution already.
> 

So you want irregular shaped forms that may also bend and aren't lying
flat on the floor?
That should be possible of course but would probably take POV a couple
of  days to parse... ;)
By that time the torch will be burnt out ( - problem solved).

My idea would be to either take some irregularly placed cylinders (that
would be easy in a loop or macro) or make a torch that is built from
fairly straight twigs tied together (just a bunch of cylinders with
toruses).
Add some 'noise' and nobody will probably notice that you have defied
reality. 8)

Seriously: I don't think realism (either photographic or physical) makes
a great picture or animation... Reality can often be quite boring,
especially the aspects that are easy to recreate in a program like
POVRay ;)

Good luck,

Remco


Post a reply to this message

From: -s0da-
Subject: Re: Pile of sticks?
Date: 2 Oct 2003 20:03:15
Message: <3f7cbcc3$1@news.povray.org>
what a GREAT answer.  Seriously.

never looked at it that way.

Thanks seriously..for the input!

"Remco de Korte" <rem### [at] onwijscom> wrote in message
news:3F7CB6BC.D5AFD70E@onwijs.com...
> -s0da- wrote:
> >
> > well...what I'm actually trying to do is simulate brush laying
> > in a metal torch type frame.
> >
> > So I guess detail wouldn't matter...I could probalby even
> > just make a good enough texture/material that might work,
> > as the flame will probably cancel out any detail of the sticks
> > anyways.
> >
> > just wonderin' if someone else had already come up with
> > (as you put it) some simple, elegant solution already.
> >
>
> So you want irregular shaped forms that may also bend and aren't lying
> flat on the floor?
> That should be possible of course but would probably take POV a couple
> of  days to parse... ;)
> By that time the torch will be burnt out ( - problem solved).
>
> My idea would be to either take some irregularly placed cylinders (that
> would be easy in a loop or macro) or make a torch that is built from
> fairly straight twigs tied together (just a bunch of cylinders with
> toruses).
> Add some 'noise' and nobody will probably notice that you have defied
> reality. 8)
>
> Seriously: I don't think realism (either photographic or physical) makes
> a great picture or animation... Reality can often be quite boring,
> especially the aspects that are easy to recreate in a program like
> POVRay ;)
>
> Good luck,
>
> Remco


Post a reply to this message

From: Tom A 
Subject: Re: Pile of sticks?
Date: 6 Oct 2003 12:17:18
Message: <3f81958e$1@news.povray.org>
-s0da- wrote:

> what a GREAT answer.  Seriously.
> 
> never looked at it that way.
> 
> Thanks seriously..for the input!
> 
> "Remco de Korte" <rem### [at] onwijscom> wrote in message
> news:3F7CB6BC.D5AFD70E@onwijs.com...
> 
>>-s0da- wrote:
>>
>>>well...what I'm actually trying to do is simulate brush laying
>>>in a metal torch type frame.
>>>
>>>So I guess detail wouldn't matter...I could probalby even
>>>just make a good enough texture/material that might work,
>>>as the flame will probably cancel out any detail of the sticks
>>>anyways.
>>>
>>
>>My idea would be to either take some irregularly placed cylinders (that
>>would be easy in a loop or macro) or make a torch that is built from
>>fairly straight twigs tied together (just a bunch of cylinders with
>>toruses).
>>Add some 'noise' and nobody will probably notice that you have defied
>>reality. 8)
>>
>>Seriously: I don't think realism (either photographic or physical) makes
>>a great picture or animation... Reality can often be quite boring,
>>especially the aspects that are easy to recreate in a program like
>>POVRay ;)
>>
>>Good luck,
>>
>>Remco

Random objects, placed without regards to physics, sometimes works well. 
  In my War of the Worlds picture 
(http://www.geocities.com/meteoricshipyards/WotW640.jpg) the rubble is 
placed randomly (except for the I-beams on the street - I made sure they 
were flat on the street, but the angle and placement was random).  The 
rubble is just random sized boxes, and I-beam objects, some still 
"falling" and in the air - but I was pleased with the final effect.

Tom A.


Post a reply to this message

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