POV-Ray : Newsgroups : povray.advanced-users : Request: transform from a rectangle. : Re: Request: transform from a rectangle. Server Time
29 Jul 2024 08:16:19 EDT (-0400)
  Re: Request: transform from a rectangle.  
From: Slime
Date: 28 Sep 2002 23:57:40
Message: <3d967a34$1@news.povray.org>
OK. This should, in theory, do the trick, but it's untested code.

I'm going to take the box
box {<0,0,0>,<L,H,W>}
and make it fit your four points. The point <0,0,0> on the box will
correspond to the point pBb (the back right of the train car).

(pAf,  pBf,  pAb,  pBb must be predefined)

#declare newx = vnormalize(pBf-pBb);
#declare newz = vnormalize(pAb-pBb);
#declare newy = vcross(newz,newx);
matrix <
newx.x,newx.y,newx.z,
newy.x,newy.y,newy.z,
newz.x,newz.y,newz.z,
pBb.x,pBb.y,pBb.z
>

Give that a shot.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

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