|
![](/i/fill.gif) |
Tyler Eaves wrote:
> On Wed, 07 Sep 2005 14:58:11 -0400, Mike Williams
> <nos### [at] econym demon co uk> wrote:
>> #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
I'm assuming you're generating P1 & P2 somewhere else? I believe you
either have to ensure both y points are the same before passing them to
the macro or else remove them in the macro. Does this work?
#include "transforms.inc"
#macro aligned_box(P1, P2, H, W)
#local L = abs(vlength(P2-P1));
#local FP1 = <P1.x, 0, P1.z>;
#local FP2 = <P2.x, 0, P2.z>;
box {<0,-H/2,-W/2><L,H/2,W/2>
transform {Reorient_Trans(x,FP2-FP1)}
translate P1
}
RG
Post a reply to this message
|
![](/i/fill.gif) |