POV-Ray : Newsgroups : povray.newusers : loop 'falling over' Server Time
31 Oct 2024 10:21:45 EDT (-0400)
  loop 'falling over' (Message 1 to 5 of 5)  
From: Graham
Subject: loop 'falling over'
Date: 21 Jan 2009 06:50:01
Message: <web.49770b5d59559b8e7fae05f50@news.povray.org>
The attached file was an attempt on my part to resolve the problem of randomly
placing objects in a plane or region in a plane so that none of the items
intersect.

In any case, part way through the render it stops, usually after 4 items are
placed and usually before 12 items are placed on top of my cylinder.

Can anyone explain why it falls over, and how to rectify it?

The file (as a .txt) can be seen at:
  http://docs.google.com/Doc?id=dc55n64c_1hsvhk6gm


Post a reply to this message

From: Chris B
Subject: Re: loop 'falling over'
Date: 21 Jan 2009 08:11:27
Message: <49771eff@news.povray.org>
"Graham" <nomail@nomail> wrote in message 
news:web.49770b5d59559b8e7fae05f50@news.povray.org...
> The attached file was an attempt on my part to resolve the problem of 
> randomly
> placing objects in a plane or region in a plane so that none of the items
> intersect.
>
> In any case, part way through the render it stops, usually after 4 items 
> are
> placed and usually before 12 items are placed on top of my cylinder.
>
> Can anyone explain why it falls over, and how to rectify it?
>
> The file (as a .txt) can be seen at:
>  http://docs.google.com/Doc?id=dc55n64c_1hsvhk6gm
>

Your inner loop is looping forever.
If you add:
  #debug concat("SizInt: ",str(SizInt,3,3),"\n")
to the end of your inner loop you'll see that it never reaches the end 
condition where SizInt>=6, so it keeps going.

I don't think the min_extents and max_extents functions are doing exactly 
what you think they're doing because I believe these work more on bounding 
boxes of the intersecting objects than on the actual bits of space occupied 
by the parts of the object. As soon as the bounding box from the union of 
dice fills the cylinder your condition therefore fails to end the loop, even 
though there's space available between the existing dice. ie it can't find a 
position where the bounding boxes don't intersect.

You're probably better off recording the centre positions of the dice in an 
array and looping through the array to see if the centre to centre distance 
of the next dice from each existing dice is large enough to avoid 
collisions.

Regards,
Chris B.


Post a reply to this message

From: Graham
Subject: Re: loop 'falling over'
Date: 23 Jan 2009 08:15:01
Message: <web.4979c1ec166d13c07fae05f50@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> Your inner loop is looping forever.
> If you add:
>   #debug concat("SizInt: ",str(SizInt,3,3),"\n")
> to the end of your inner loop you'll see that it never reaches the end
> condition where SizInt>=6, so it keeps going.
>
> I don't think the min_extents and max_extents functions are doing exactly
> what you think they're doing because I believe these work more on bounding
> boxes of the intersecting objects than on the actual bits of space occupied
> by the parts of the object. As soon as the bounding box from the union of
> dice fills the cylinder your condition therefore fails to end the loop, even
> though there's space available between the existing dice. ie it can't find a
> position where the bounding boxes don't intersect.
>
> You're probably better off recording the centre positions of the dice in an
> array and looping through the array to see if the centre to centre distance
> of the next dice from each existing dice is large enough to avoid
> collisions.
>
> Regards,
> Chris B.

Thanks Chris,
  That was what I was hoping to avoid, but I've done it, and I'm happy with the
results. Basically having fun with wood, chrome and glass, particularly a
convex/concave meeting of chrome and glass, and the interplay of a bright
burning sun. Here is the immediate result:
http://au.geocities.com/gjdolby/jpgs/pillar_20.jpg and here is the evolution:
http://au.geocities.com/gjdolby/gifs/yahtzee.gif

Regards, Graham


Post a reply to this message

From: Chris B
Subject: Re: loop 'falling over'
Date: 23 Jan 2009 08:43:21
Message: <4979c979@news.povray.org>
> Here is the immediate result:
> http://au.geocities.com/gjdolby/jpgs/pillar_20.jpg and here is the 
> evolution:
> http://au.geocities.com/gjdolby/gifs/yahtzee.gif
>
> Regards, Graham
>

I think I preferred the colors in the original. The original seems to be 
gold whereas pillar_20 seems a bit more brassy.
The dice in yahtzee seem to be loaded. :-)


Post a reply to this message

From: Graham
Subject: Re: loop 'falling over'
Date: 23 Jan 2009 09:55:00
Message: <web.4979d948166d13c07fae05f50@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> I think I preferred the colors in the original. The original seems to be
> gold whereas pillar_20 seems a bit more brassy.
> The dice in yahtzee seem to be loaded. :-)

They are both texture{Polished_Chrome}. In the original it is reflecting an
otherwise unseen yellow sky_sphere, and the latter is reflecting the bright
yellow sun and blue & white clouded sky_sphere, either directly (on the wall
and die tops), or through a texture{T_Glass1} lens, on the flat surface of
which the five dice rest, permitting a view of several distorted additional
reflections resulting from the curvature beneath. The reflected sun cutting
back between the dice towards the camera was serendipitous.

:) I thought that,
1) if I was going to call it Yahtzee it should display a five of a kind roll.
2) at 800x600, a 6 frame animated .gif was going to be large enough in this
   situation, without being too huge. That being said I have the bare bones
   of an idea based on several different povray animations - if I do it well
   enough it should induce vertigo in some. That one will be 1280x1024 and at
   least 360 frames. Actually, there will be two of them (again, if I do it
   well enough).

More later. :)


Post a reply to this message

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