POV-Ray : Newsgroups : povray.newusers : Aligned box? : Re: Aligned box? Server Time
29 Jul 2024 14:14:22 EDT (-0400)
  Re: Aligned box?  
From: Tyler Eaves
Date: 7 Sep 2005 20:12:09
Message: <op.swrb8gcw05glvk@localhost.localdomain>
On Wed, 07 Sep 2005 14:58:11 -0400, Mike Williams  
<nos### [at] econymdemoncouk> wrote:

> Wasn't it Tyler Eaves who wrote:
>> I'm looking for some way to specify a box at an angle. The way I see  
>> it, a
>> box could be specified by giving 2 points, which would be the center of
>> two oppisite faces, and would define one dimesion, call it length, and
>> then giving the length of the width and height. This would be roughly
>> comprable to the way a cylinder is specified. I can't seem to think of  
>> any
>> obvious way to do this (3d math is not a strength of mine...)
>
> The first thing that springs to mind is to write a macro like this:
>
> #include "transforms.inc"
> #macro aligned_box(P1, P2, H, W)
>   #local L = abs(vlength(P2-P1));
>   box {<0,-H/2,-W/2><L,H/2,W/2>
>     transform {Reorient_Trans(x,P2-P1)}
>     translate P1
>   }
> #end
>

That comes VERY close. Actually, it works as I requested, although missing  
an implied criteria. I didn't specify it, but I need the box to maintain a  
vertical orientation, whereas your macro induces a rotation around the  
P1-P2 axis. I'm guessing this is an artifact of the Reorient_Trans



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


Post a reply to this message

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