POV-Ray : Newsgroups : povray.general : unexpected rotation result : Re: unexpected rotation result Server Time
8 Aug 2024 08:15:56 EDT (-0400)
  Re: unexpected rotation result  
From: Tom Melly
Date: 5 Feb 2001 06:19:45
Message: <3a7e8c51@news.povray.org>
"PoD" <pod### [at] merlinnetau> wrote in message
news:3A7E8847.C9EFB12A@merlin.net.au...

> 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>
>

Yep, got it figured now. I'd never taken in that rotate y on its own meant
anything, so I'd misunderstood what the * in rotate y*45 meant (I vaguely
assumed it was to allow the parser to recognise a single vector
transformation).

That aside, intuitively, I would still have expected "rotate y * foo + bar"
to limit the rotations to the y axis. Still, now I know.....

All in all, it reminds me of what someone at work told me. He is an
experienced programmer and script writer, but he always uses brackets - e.g.

x := ((x*45) + 10)

When I asked him why, he said that a) he doesn't have to worry about someone
screwing up the parser, b) it makes the code clearer and c) why not?


Post a reply to this message

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