POV-Ray : Newsgroups : povray.newusers : Aligned box? : Re: Aligned box? Server Time
29 Jul 2024 14:15:02 EDT (-0400)
  Re: Aligned box?  
From: gonzo
Date: 8 Sep 2005 00:41:39
Message: <431fc103@news.povray.org>
Mike Williams 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
> 


Hey cool!  Thanks Mike, I was just trying to figure out how to make a 
box that acted like a cylinder!

RG  -  I can't count the times I've had a question to ask here that I 
never asked because someone had already posted the answer


Post a reply to this message

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