POV-Ray : Newsgroups : povray.general : Trace question : Re: Trace question Server Time
1 Aug 2024 12:26:00 EDT (-0400)
  Re: Trace question  
From: Rick Measham
Date: 23 Oct 2005 22:37:58
Message: <435c4906$1@news.povray.org>
Anthony D. Baye wrote:
>     After a little thought, I was able to implement a stacking function 
> based largely off the code snip you posted. I am, however, still getting 
> some overlap.  I think it's going to have to be a combination of the two 
> methods suggested.
>     I need to figure out a way to trick the macro into thinking that the 
> object's bounds extend a minimum distance (Laterally) from the actual 
> object.  Can this be done by setting the bounding box manually?  If so, 
> how is this accomplished?

I think you'll need to run four traces per cube for each of the corners 
on the XZ plane. (and if you're rotating, you might want to add more 
traces along each side ..)

You can then take the higest Y of the four traces as the lowest your 
object can be at that point. If you ignore balancing, that's where to 
place your next cube. If you want to take balancing into account, I 
reckon you're screwed .. consider this:

   +---+
   |   |
   +---+
+---+
|   |
+---+

That would probably balance OK. But then if you go up another level:

     +---+
     |   |
     +---+
   +---+
   |   |
   +---+
+---+
|   |
+---+

it's clearly going to topple the middle one off the stack as well as the 
top one. And once you've placed it, you can't move it (unless you're 
working with an array which you'll later render) and the correct 'fall' 
might be this:

      _-+
     +   \
      \  _+
+---+ +- +---+
|   |    |   |
+---+    +---+

which is all the harder :)


Personally, I'd either be positioning them all by hand, ignoring balance 
or calculating falls externally (like a perl or C program)

Cheers!
Rick Measham


Post a reply to this message

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