POV-Ray : Newsgroups : povray.general : my_array[i][j][? ]=3D <1,2,3> Server Time
6 Nov 2024 04:17:17 EST (-0500)
  my_array[i][j][? ]=3D <1,2,3> (Message 1 to 7 of 7)  
From: Tony LaVigne
Subject: my_array[i][j][? ]=3D <1,2,3>
Date: 31 Oct 2002 17:40:02
Message: <web.3dc1b12b2dddf81788d4e3910@news.povray.org>
Hello,
As you can see this is an array question.
I want to insert  3 elements ( a 3-D vector) into an array, something like;

#declare X = array[10][10][4];
#declare my_array[i][j][?]= vcross(A,B);

What would go in place of the "?"


Currently I have to declare them one at at time, something like;

#declare X = array[10][10][4];
#declare D = vcross(A,B);
#declare my_array[i][j][1]= D.x;
#declare my_array[i][j][2]= D.y;
#declare my_array[i][j][3]= D.z;

Thanks


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: my_array[i][j][? ]=3D3D <1,2,3>
Date: 31 Oct 2002 18:05:03
Message: <web.3dc1b61ea04f59538149fba0@news.povray.org>
Tony LaVigne wrote:
>Hello,
>As you can see this is an array question.
>I want to insert  3 elements ( a 3-D vector) into an array, something like;
>
>#declare X = array[10][10][4];
>#declare my_array[i][j][?]= vcross(A,B);
>
>What would go in place of the "?"
>
>
>Currently I have to declare them one at at time, something like;
>
>#declare X = array[10][10][4];
>#declare D = vcross(A,B);
>#declare my_array[i][j][1]= D.x;
>#declare my_array[i][j][2]= D.y;
>#declare my_array[i][j][3]= D.z;

How about this ?


..
..
..
#declare vA = <1, 3, 2>;
#declare vB = <-4, 7, -2>;
..
..
..
#declare YourArray = array[10][10]
..
..
..
#declare YourArray[6][8] = vcross(vA, vB);
#declare YourArray[6][9] = vcross(vC, vD);
..
..
..


Tor Olav


Post a reply to this message

From: Christopher James Huff
Subject: Re: my_array[i][j][? ]=3D <1,2,3>
Date: 31 Oct 2002 19:23:02
Message: <chrishuff-2DB5CB.19153831102002@netplex.aussie.org>
In article <web.3dc1b12b2dddf81788d4e3910@news.povray.org>,
 "Tony LaVigne" <ton### [at] xenomechanicscom> wrote:

> As you can see this is an array question.
> I want to insert  3 elements ( a 3-D vector) into an array, something like;
> #declare X = array[10][10][4];
> #declare my_array[i][j][?]= vcross(A,B);
> What would go in place of the "?"

Any number from 0 to 3.


> Currently I have to declare them one at at time, something like;
> #declare X = array[10][10][4];
> #declare D = vcross(A,B);
> #declare my_array[i][j][1]= D.x;
> #declare my_array[i][j][2]= D.y;
> #declare my_array[i][j][3]= D.z;

Well, a vector is not an array, and an array is not a vector. You need 
to use an array of vectors or set each component to a different array 
element. And you are reserving 4 elements, you only need 3.

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

From: Tony LaVigne
Subject: Re: my_array[i][j][? ]=3D3D <1,2,3>
Date: 31 Oct 2002 21:05:06
Message: <web.3dc1e071a04f59588d4e3910@news.povray.org>
Christopher James Huff wrote:
>In article <web.3dc1b12b2dddf81788d4e3910[at]news.povray.org>,
> "Tony LaVigne" <ton### [at] xenomechanicscom> wrote:
>
>> As you can see this is an array question.
>> I want to insert  3 elements ( a 3-D vector) into an array, something like;
>> #declare X = array[10][10][4];
>> #declare my_array[i][j][?]= vcross(A,B);
>> What would go in place of the "?"
>
>Any number from 0 to 3.
>
>
>> Currently I have to declare them one at at time, something like;
>> #declare X = array[10][10][4];
>> #declare D = vcross(A,B);
>> #declare my_array[i][j][1]= D.x;
>> #declare my_array[i][j][2]= D.y;
>> #declare my_array[i][j][3]= D.z;
>
>Well, a vector is not an array, and an array is not a vector.
>You need
>to use an array of vectors or set each component to a different array
>element. And you are reserving 4 elements, you only need 3.
>
>Christopher James Huff <cja### [at] earthlinknet>
>http://home.earthlink.net/~cjameshuff/
>POV-Ray TAG: chr### [at] tagpovrayorg
>http://tag.povray.org/
>

Can I have an array of vectors?
can each element of my_array[][] be a 3-d vector?


Post a reply to this message

From: Slime
Subject: Re: my_array[i][j][? ]=3D3D <1,2,3>
Date: 31 Oct 2002 21:36:04
Message: <3dc1e894$1@news.povray.org>
> Can I have an array of vectors?
> can each element of my_array[][] be a 3-d vector?


Yes.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Tony LaVigne
Subject: Re: my_array[i][j][? ]=3D3D3D <1,2,3>
Date: 31 Oct 2002 22:40:03
Message: <web.3dc1f6b2c4958c2488d4e3910@news.povray.org>
Slime wrote:
>> Can I have an array of vectors?
>> can each element of my_array[][] be a 3-d vector?
>
>
>Yes.
>
> - Slime
>

Thank goodness...
This is much easier.
Thanks

ton### [at] xenomechanicscom


Post a reply to this message

From: W&#322;odzimierz ABX Skiba
Subject: Re: my_array[i][j][? ]=3D3D3D3D <1,2,3>
Date: 1 Nov 2002 13:15:04
Message: <web.3dc2c3a2109214d46383743d0@news.povray.org>
Tony LaVigne wrote:
> Thank goodness...
> This is much easier.
> Thanks

BTW: here is second sentence from array section in documentation: "Any item
that can be declared as an identifier can be declared in an array".

ABX


Post a reply to this message

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