![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
This would be trivial to implement with macros. Especially when (if) the
Superpatch's #ifdef(Array[Elem]) function makes it into the official
version. Until then the size of the array would need to be specified.
For example, array rotate:
#macro ARot(Array,ArraySize,RotVect)
#local C=0;
#local NewArray=array[ArraySize]
#while(C<ArraySize)
#local NewArray[C]=vrotate(Array[C],RotVect);
#local C=C+1;
#end
NewArray
#end
#declare Array1=array[N]{...}
#declare Array2=ARot(Array1,N,<XRot,YRot,ZRot>)
Margus
J. Grimbert wrote in message <3740210A.4E1BDC0E@atos-group.com>...
>
>What is needed is probably more something like array operator.
>After all, pov have :
> rotate and translate for objects
> vrotate and + for vectors
>
>We may probably get a nice enhancement with something like
> arotate and atranslate for array of vector
>
>#declare new_array = arotate(old_array, B );
>
>and
>#declare new_array = atranslate(old_array, B);
>
>BTW, we could also need some scaling:
>#declare new_array = ascale(old_array, B);
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Tue, 18 May 1999 17:59:48 +0300, Margus Ramst wrote:
>This would be trivial to implement with macros. Especially when (if) the
>Superpatch's #ifdef(Array[Elem]) function makes it into the official
>version. Until then the size of the array would need to be specified.
No need for the #ifdef patch. In fact, it will fail if you try to
access past the end of the array anyway. What you need is this,
from the official POV 3.1:
dimension_size( ARRAY_IDENTIFIER, FLOAT ) Returns the size of a given
dimension of a previously declared array identifier. Dimensions are
numbered left-to-right starting with 1. For example if you do
#declare MyArray=array[6][10] then dimension_size(MyArray,2) returns
the value 10.
and your macro becomes:
#macro ARot(Array,RotVect)
#local C=dimension_size(Array,1);
#local NewArray=array[C]
#while(C>0)
#local C=C-1;
#local NewArray[C]=vrotate(Array[C],RotVect);
#end
NewArray
#end
or, to transform an array "in place":
#macro AInPlaceRot(Array,RotVect)
#local C=dimension_size(Array,1);
#while(C>0)
#local C=C-1;
#declare Array[C]=vrotate(Array[C],RotVect);
#end
#end
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Ron Parker wrote:
> No need for the #ifdef patch.
What if you do this:
#declare MyArray=array[3]
#declare MyArray[0]="A"
#declare MyArray[2]="C"
How do you check if MyArray[1] is declared...?
- Mikael.
-----------------------------------------------------------------
Mikael Carneholm
Dep. of Computer Science
http://www.studenter.hb.se/~arch
E-mail: sa9### [at] ida utb hb se
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Tue, 18 May 1999 19:25:20 +0200, Mikael Carneholm wrote:
>Ron Parker wrote:
>
>> No need for the #ifdef patch.
>
>What if you do this:
>
>#declare MyArray=array[3]
>#declare MyArray[0]="A"
>#declare MyArray[2]="C"
>
>How do you check if MyArray[1] is declared...?
More importantly, how do you check if MyArray[0] is a vector?
I'm not saying it wouldn't help, but you don't need it just
to get the array size, as you seemed to imply.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hell and damnation!!!! I could swear I read all about float functions and
arrays, and never did I see these functions. Now they're there. To think how
much trouble this would've saved me in the past...
Oh well, thank you for pointing it out.
Margus
Ron Parker wrote in message <37419412.0@news.povray.org>...
>
>No need for the #ifdef patch. In fact, it will fail if you try to
>access past the end of the array anyway. What you need is this,
>from the official POV 3.1:
>
> dimension_size( ARRAY_IDENTIFIER, FLOAT ) Returns the size of a given
> dimension of a previously declared array identifier. Dimensions are
> numbered left-to-right starting with 1. For example if you do
> #declare MyArray=array[6][10] then dimension_size(MyArray,2) returns
> the value 10.
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
To put things straight, #ifdef was my suggestion. I now see that it really
isn't necessary.
It should be up to the user to know that the manipulated array contains
vectors. Or values could be forced to vectors in the macro (value+<0,0,0> or
something similar).
Right now I can't think of a common situation where an intermittent array
element would be missing (it has never happened in the procedures I use with
arrays). But #ifdef could be used as a check here.
Margus
Ron Parker wrote in message <3741a5be.0@news.povray.org>...
>On Tue, 18 May 1999 19:25:20 +0200, Mikael Carneholm wrote:
>>Ron Parker wrote:
>>
>>> No need for the #ifdef patch.
>>
>>What if you do this:
>>
>>#declare MyArray=array[3]
>>#declare MyArray[0]="A"
>>#declare MyArray[2]="C"
>>
>>How do you check if MyArray[1] is declared...?
>
>More importantly, how do you check if MyArray[0] is a vector?
>I'm not saying it wouldn't help, but you don't need it just
>to get the array size, as you seemed to imply.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |