POV-Ray : Newsgroups : povray.newusers : Aligned box? : Re: Aligned box? Server Time
29 Jul 2024 14:14:32 EDT (-0400)
  Re: Aligned box?  
From: Mike Williams
Date: 7 Sep 2005 14:58:16
Message: <gE4reDADhzHDFwbT@econym.demon.co.uk>
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

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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