POV-Ray : Newsgroups : povray.beta-test : [std inc] array manipulation macros Server Time
29 Jul 2024 16:24:40 EDT (-0400)
  [std inc] array manipulation macros (Message 1 to 5 of 5)  
From:
Subject: [std inc] array manipulation macros
Date: 25 Apr 2002 08:09:08
Message: <ttqfcu898alr5j9i84qg6it39f569bkjc6@4ax.com>
Some time ago I promised to prepare macros for arrays.inc. Here they are.
I prepared multi resize version, asked for inclusion and I'm sure it was
atached at least in one beta distribution but I can't find it at this
moment so I don't know should I add multi dimensional exceptions of below
macros. I hope my interpretation of destination is correct.

related posts :
http://news.povray.org/madqttov353hsu8gaef92809kscol9pre3%404ax.com
http://news.povray.org/jsl5rt43ngjm9bsg59ishf03u4ghm4621c%404ax.com

#macro Insert_In_Array(Item, DestArray, Index)
  #if( dimensions( DestArray ) = 1 )
    #local Size = dimension_size( DestArray , 1 );
    #if(Index>=Size)
      Resize_Array( DestArray , Index + 1 )
    #end
    #declare DestArray[ Index ] = Item;
  #else
    #error "Can't insert in multi dimensional array"
  #end
#end

#macro Insert_Array_In_Array(ItemArray, DestArray, Index)
  #if( dimensions( DestArray ) = 1 )
    #if( dimensions( ItemArray ) = 1 )
      #local Size = dimension_size( DestArray , 1 );
      #local Insert_Size = dimension_size( ItemArray , 1 );
      #if((Index+Insert_Size)>Size)
        Resize_Array( DestArray , Index+Insert_Size )
      #end
      #local C=0;
      #while (C<Insert_Size)
        #ifdef(ItemArray[C])
          #declare DestArray[C+Index] = ItemArray[C];
        #end
        #local C=C+1;
      #end
    #else
      #error "Can't insert multi dimensional array in single dimensional array"
    #end
  #else
    #error "Can't insert in multi dimensional array"
  #end
#end

#macro Append_To_Array(Item, DestArray, Index)
  #if( dimensions( DestArray ) = 1 )
    #local Size = dimension_size( DestArray , 1 );
    #if(Index>=Size)
      Insert_In_Array(Item, DestArray, Index)
    #else
      #local Array = array[ Size+1 ];
      #local Array[ Index ] = Item;
      #local C=0;
      #while (C<Size)
        #ifdef( DestArray[ C ] )
          #declare Array[ C+(C>=Index) ] = DestArray[ C ];
        #end
        #local C=C+1;
      #end
      #declare DestArray = Array;
    #end
  #else
    #error "Can't append to multi dimensional array"
  #end
#end

#macro Append_Array_To_Array(ItemArray, DestArray, Index)
  #if( dimensions( DestArray ) = 1 )
    #if( dimensions( ItemArray ) = 1 )
      #local Size = dimension_size( DestArray , 1 );
      #if(Index>=Size)
        Insert_Array_In_Array(ItemArray, DestArray, Index)
      #else
        #local Insert_Size = dimension_size( ItemArray , 1 );
        #local Array = array[ Size + Insert_Size ];
        #local C=Insert_Size;
        #while (C>0)
          #local C=C-1;
          #ifdef( ItemArray[ C ] )
            #local Array[ Index + C] = ItemArray[ C ];
          #end
        #end
        #while (C<Size)
          #ifdef( DestArray[ C ] )
            #local Array[ C+Insert_Size*(C>=Index) ] = DestArray[ C ];
          #end
          #local C=C+1;
        #end
        #declare DestArray = Array;
      #end
    #else
      #error "Can't append multi dimensional array to single dimensional array"
    #end
  #else
    #error "Can't append to multi dimensional array"
  #end
#end

ABX


Post a reply to this message

From:
Subject: Re: [std inc] array manipulation macros
Date: 12 Jul 2002 03:54:02
Message: <cd2tiu0sbhpffjsg1gm9lhe69ci0nsqu97@4ax.com>

wrote:
> macros for arrays.inc. Here they are.

I wonder why my effort was wasted?

ABX


Post a reply to this message

From: Rune
Subject: Re: [std inc] array manipulation macros
Date: 12 Jul 2002 11:10:49
Message: <3d2ef179@news.povray.org>
"Wlodzimierz ABX Skiba" wrote:
> > macros for arrays.inc. Here they are.
>
> I wonder why my effort was wasted?

I'm sorry, there are many things that didn't make it to the
distribution.

If I recall correctly, there was several things about the usage of the
macros that I found odd and confusing, but unfortunately I didn't have
time to discuss it with you. The spline macros that I had been working
on myself also weren't included.

Fortunately none of our efforts are wasted, because we can still release
our macros by regular means through the newsgroups or websites etc.

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com (updated July 12)
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: Fractracer
Subject: Re: [std inc] array manipulation macros
Date: 30 Dec 2013 05:40:01
Message: <web.52c14cdf78eb75db90cbcd420@news.povray.org>


> wrote:
> > macros for arrays.inc. Here they are.
>
> I wonder why my effort was wasted?
>

I am surprised also, I have searched for macros like this, why they are not
include in the file arrays.inc (where they are simply named and commented)?


Post a reply to this message

From: Le Forgeron
Subject: Re: [std inc] array manipulation macros
Date: 2 Jan 2014 03:17:14
Message: <52c5208a@news.povray.org>
Le 30/12/2013 11:37, Fractracer a écrit :
> W³odzimierz ABX Skiba <abx### [at] babilonorg> wrote:
>> On Thu, 25 Apr 2002 14:08:28 +0200, W³odzimierz ABX Skiba <abx### [at] babilonorg>
>> wrote:
>>> macros for arrays.inc. Here they are.
>>
>> I wonder why my effort was wasted?
>>
> 
> I am surprised also, I have searched for macros like this, why they are not
> include in the file arrays.inc (where they are simply named and commented)?

If you look at the date of the first message (2002), I believe there
might be a problem of licensing:
 * there is no explicit license in the first message
 * at that time, the license of povray was different from the current
AGPL (if I got that right)
 * cannot contact the original poster to clarify

(and to make matter more complex: Poland might not recognize IP about
trivial algorithm but some bigger confederations on other continent
might: so the lack of explicit license might not be a problem in Poland,
but the usage as such in a state of U.S.A. might violate (or not) one or
more patents...)


-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

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