POV-Ray : Newsgroups : povray.newusers : Newbie syntax problem : Re: Newbie syntax problem Server Time
4 Sep 2024 22:16:04 EDT (-0400)
  Re: Newbie syntax problem  
From: Christopher James Huff
Date: 12 Nov 2002 21:45:16
Message: <chrishuff-349F18.21444512112002@netplex.aussie.org>
In article <3DD1B253.575E6908@pacbell.net>, Ken <tyl### [at] pacbellnet> 
wrote:

> Should it be fixed, and if so in what way? There are only a couple of
> places where a 2D vector statement is useful while there are dozens of
> places where a 3D vector is mandatory.

Simple:
Assigning to a vector results in a vector of the same size as the 
original. If the "source" is too small, it is extended with 0's. (except 
for scalars, where every component of the resulting vector gets set to 
the scalar's value) If it is too big, it is truncated.
If something needs a 3D vector, it gets one, whether you give it a 
scalar, a 2D vector, or a 10D vector. If something needs a 2D vector, it 
gets one. The same for scalars, 4D vectors, 5D vectors...maybe POV could 
be changed to handle any size vectors, though some functions would still 
require specific sizes.

#declare scalar = 1; //scalar is a scalar value, one float
#declare vect2d = < 0, 0>; //vect2d is a 2D vector
#declare vect3d = < 0, 0, 0>; //vect3d is a 3D vector

scalar = < 1, 2> results in 1.
scalar = < 1, 2, 3> results in 1.

vect2d = < 1, 2, 3> results in < 1, 2>, maybe giving a warning.
vect3d = < 1, 2> results in < 1, 2, 0>.

vect2d = 3.14 results in < 3.14, 3.14>.
vect3d = 3.14 results in < 3.14, 3.14, 3.14>.

This is what I think anyone would expect from reading the existing 
documentation, and what seems most useful.


> I think the current behavior is useful and would support its 
> continued use if asked to vote on it.

What would you use the current behavior for? It seems unexpected that 
declaring a 2D vector results in a 3D vector, it requires workarounds to 
get the desired result, and I can't think of any time you would actually 
want it.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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