|
|
Warp wrote:
> The standard arrays.inc already provides a Sort_Array() macro.
>
> http://wiki.povray.org/content/Documentation:Reference_Section_7#arrays.inc
>
True, but it does one array! It doesn't move associated arrays with it.
My idea is you have a group of arrays linked so if you sort using one of
them all the others are also move around. The Sort_Array() macro could
be modified to do so. You would have to rewrite it for every time the
number of arrays you have changed. I basically do that rewrite for ya.
What I had in mind is you put the Master name and all the sub names
into 'Linker' and it would make all the arrays and macros you need.
As an example I want a 50 element array of Robots. I'd use 'Robot' as
the Master and subs of 'Color', 'Location' and 'Active'. 'Linker' will
make this:
#declare RoBot_Color=array[50];
#declare RoBot_Location=array[50];
#declare RoBot_Active=array[50];
#macro RoBot_Put(Element,ColorV,LocationV,ActiveV)...
#macro RoBot_Get(Element,ColorV,LocationV,ActiveV)...
#macro RoBot_Swap(Element1,Element2)...
#macro RoBot_Copy(Element1,Element2)...
#macro RoBot_Sort(Array)...
Now all I have to do is fill up the arrays and do something with them.
The macros will only work with the 3 arrays. Now back to 'Sort' the way
I it is now I didn't use the Sort_Array() from 'arrays.inc'. I made an
simpler one that was easier to write to file.
Post a reply to this message
|
|