POV-Ray : Newsgroups : povray.newusers : Aligned box? : Re: Aligned box? Server Time
25 Nov 2024 16:23:12 EST (-0500)
  Re: Aligned box?  
From: Tyler Eaves
Date: 8 Sep 2005 08:54:38
Message: <op.swsbjdax05glvk@localhost.localdomain>
On Thu, 08 Sep 2005 04:07:01 -0400, Mike Williams  
<nos### [at] econymdemoncouk> wrote:

> #macro Reorient_Trans_Sky(vec, Sky)
>     #local mapxto = vnormalize(vec);
>     #local mapzto = vnormalize(vcross(Sky, vec));
>     #local mapyto = vnormalize(vcross(mapxto, mapzto));
>     matrix <
>         mapxto.x, mapxto.y, mapxto.z,
>         mapyto.x, mapyto.y, mapyto.z,
>         mapzto.x, mapzto.y, mapzto.z,
>         0,0,0
>     >
> #end
> #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_Sky(P2-P1,y)}
>     translate P1
>   }
> #end

Works great! This is insanely useful.


-- 
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.