POV-Ray : Newsgroups : povray.general : Translate a point : Re: Translate a point Server Time
10 Aug 2024 15:18:50 EDT (-0400)
  Re: Translate a point  
From: Bill DeWitt
Date: 1 Dec 1999 08:23:38
Message: <3845215a@news.povray.org>
I'm digging into that now, Thanks!

"John VanSickle" <van### [at] erolscom> wrote in message
news:38448D22.5D5F2B52@erols.com...
> Bill DeWitt wrote:
> >
> > I thought I knew how to do this once, but now I can't even find the
> > keyword
> > I want. I have a point:
> > #declare A_Point = 0;
> > and I want to move it...
> > #declare A_Point = A_Point +My_Transform;
>
> You can't apply a declared transform directly to a point in the
> standard POV release (there may be a patch out there somewhere).
>
> What you have to do instead is apply the components of the transform
> in order.  Scaling is done by multiplying, rotation is done with the
> vrotate() function, and translate is done with adding.
>
> The matrix transform can be applied to a point using the vmatrix()
> macro in my Thoroughly Useful Macros file, which can be found at
>
>   http://users.erols.com/vansickl/macs.htm
>
> As an example, if your transform was
>
>   #declare MyTransform= transform {
>     rotate x*45
>     scale <1,2,1>
>     translate <-34,1.2,23>
>     matrix <1,0,0, 0,.8,.6, 0,-.6,1, 0,0,0>
>   }
>
> You would transform a given point this way:
>
> #declare MyPoint=vrotate(MyPoint,x*45);
> #declare MyPoint=MyPoint*<1,2,1>;
> #declare MyPoint=MyPoint+<-34,1.2,23>;
> #declare MyPoint=vmatrix(MyPoint,<1,0,0>,<0,.8,.6>,<0,-.6,1>,<0,0,0>);
>
> Hope this helps,
> John
> --
> ICQ: 46085459


Post a reply to this message

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