POV-Ray : Newsgroups : povray.general : unexpected rotation result : Re: unexpected rotation result Server Time
8 Aug 2024 08:19:00 EDT (-0400)
  Re: unexpected rotation result  
From: PoD
Date: 5 Feb 2001 06:02:35
Message: <3A7E8847.C9EFB12A@merlin.net.au>
Tom Melly wrote:
> 
> "Gail Shaw" <gsh### [at] monotixcoza> wrote in message
> news:3a7e8216@news.povray.org...
> >
> > > rotate y * - 45 + 45
> > > rotate y * (- 45 + 45)
> > >
> >
> > I would guess that pov is doing the multiplication first then adding
> > 45.  Hence it's doing rotate <0,-45,0> + 45.
> > whereas the brackets in the second force pov
> > to evaluate the -45+45 first and multiply with y second.
> >
> 
> Ah, it would appear that my problem here was based on a more serious
> underlying misunderstanding. I've always specified single-axis rotations as,
> for example, rotate x * 45. I thought that this just meant rotate x 45
> degrees. So what does rotate x*45 mean? 45 times what?

x = <1,0,0> so x*45 = <45,0,0>

As for the first problem, the POV parser uses normal precedence rules.
It does the multiplication first, then the addition.
y = <0,1,0> so y* -45 = <0,-45,0>
then it promotes the second 45 to a vector so that it can be added
45 becomes <45,45,45>
so the end result is <0,-45,0> + <45,45,45> = <45,0,45>

-- 
PoD.


Post a reply to this message

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