POV-Ray : Newsgroups : povray.beta-test : <1, 0, 0> + 1*t : Re: <1, 0, 0> + 1*t Server Time
16 Aug 2022 23:43:00 EDT (-0400)
  Re: <1, 0, 0> + 1*t  
From: Christopher James Huff
Date: 21 Jan 2002 15:23:01
Message: <chrishuff-E3EDE9.15235821012002@netplex.aussie.org>
In article <$sPY### [at] econymdemoncouk>,
 Mike Williams <mik### [at] nospamplease> wrote:

>   #declare Test = <2,1,1,1,1>*<0,0,0,1,0>;
>   V5Show("Test ",Test) // Test:   0.00,   0.00,   0.00,   0.00,   1.00

<2,1,1,1,1>*<0,0,0,1,0> should equal <0,0,0,1,0>, not <0,0,0,0,1>. 
Again, I don't think this is a precedence bug, but a bug with converting 
float values to vectors.
(<1, 0, 0> + t*1).t
expands to:
(<1, 0, 0> + (< 0, 0, 0, 1, 0>*< 1, 1, 1, 1, 1>)).t
which equals < 1, 0, 0, 1, 0>
as it should, but
(<1, 0, 0> + 1*t).t
expands to:
(<1, 0, 0> + < 1, 1, 1, 0, 0>*< 0, 0, 0, 1, 0>).t
which equals < 1, 0, 0, 0, 0>.
However, if you use:
(<1, 0, 0, 0> + 1*t).t
All is well.

I'm guessing the code decides it's using a 3D vector when it parses the 
first vector, so it only expands the 1 to a 3D vector. When it then 
multiplies by a 4D vector, the fourth component is 0. Probably the only 
solution is to do 5D math all the time, I don't think it's possible to 
scan the expression to see the largest number of dimensions involved in 
the current parser.

-- 
 -- 
Christopher James Huff <chr### [at] maccom>


Post a reply to this message

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