|
![](/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) |