POV-Ray : Newsgroups : povray.general : Translate a point Server Time
1 Nov 2024 03:17:37 EDT (-0400)
  Translate a point (Message 1 to 6 of 6)  
From: Bill DeWitt
Subject: Translate a point
Date: 30 Nov 1999 09:05:22
Message: <3843d9a2@news.povray.org>
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;

wasn't there a v_translate() or something to do that with? I know I am going
to feel stupid when I get the answer.


Post a reply to this message

From: John VanSickle
Subject: Re: Translate a point
Date: 30 Nov 1999 21:45:52
Message: <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

From: Chris Huff
Subject: Re: Translate a point
Date: 1 Dec 1999 06:22:31
Message: <chrishuff_99-27DB3F.06224101121999@news.povray.org>
In article <38448D22.5D5F2B52@erols.com>, John VanSickle 
<van### [at] erolscom> wrote:

> You can't apply a declared transform directly to a point in the
> standard POV release (there may be a patch out there somewhere).

There is, I wrote a vtransform() patch which uses any transform. The 
source is on my web site, and I also posted a message in 
povray.programming with just the source for the vtransform() 
function(the code on my site includes a bunch of other stuff).

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Bill DeWitt
Subject: Re: Translate a point
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

From: Bill DeWitt
Subject: Re: Translate a point
Date: 1 Dec 1999 08:25:18
Message: <384521be@news.povray.org>
I don't want to test this and find out that I am wrong, but can your patch
be placed over the superpatch? Or is it perhaps included in the superpatch?

"Chris Huff" <chr### [at] yahoocom> wrote in message
news:chrishuff_99-27DB3F.06224101121999@news.povray.org...
> In article <38448D22.5D5F2B52@erols.com>, John VanSickle
> <van### [at] erolscom> wrote:
>
> > You can't apply a declared transform directly to a point in the
> > standard POV release (there may be a patch out there somewhere).
>
> There is, I wrote a vtransform() patch which uses any transform. The
> source is on my web site, and I also posted a message in
> povray.programming with just the source for the vtransform()
> function(the code on my site includes a bunch of other stuff).
>
> --
> Chris Huff
> e-mail: chr### [at] yahoocom
> Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Ron Parker
Subject: Re: Translate a point
Date: 1 Dec 1999 09:13:24
Message: <38452d04@news.povray.org>
On Wed, 1 Dec 1999 08:25:16 -0500, Bill DeWitt wrote:
>I don't want to test this and find out that I am wrong, but can your patch
>be placed over the superpatch? Or is it perhaps included in the superpatch?

Not yet, but it easily could be.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

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