Arrays.inc
Reference

From POV-Wiki
Jump to: navigation, search

This file contains macros for manipulating arrays.

ARRAYS_WriteDF3(Array, FileName, BitDepth): Write an array to a df3 file.

Parameters:

  • Array = The array that contains the data.
  • FileName = The name of the file to be written.
  • BitDepth = The size of the binary word.

Note: See the #write directive for more information.

Rand_Array_Item(Array, Stream): Randomly Picks an item from a 1D array.

Parameters:

  • Array = The array from which to choose the item.
  • Stream = A random number stream.

Resize_Array(Array, NewSize): Resize a 1D array, retaining its contents.

Parameters:

  • Array = The array to be resized.
  • NewSize = The desired new size of the array.

Reverse_Array(Array): Reverses the order of items in a 1D array.

Parameters:

  • Array = The array to be reversed.


Sort_Compare(Array, IdxA, IdxB): This macro is used by the Sort_Array() and Sort_Partial_Array() macros. The given macro works for 1D arrays of floats, but you can redefine it in your scene file for more complex situations, arrays of vectors or multidimensional arrays for example. Just make sure your macro returns true if the item at IdxA < the item at IdxB, and otherwise returns false.

Parameters:

  • Array = The array containing the data being sorted.
  • IdxA, IdxB = The array offsets of the data elements being compared.

Sort_Swap_Data(Array, IdxA, IdxB): This macro is used by the Sort_Array() and Sort_Partial_Array() macros. The given macro works for 1D arrays only, but you can redefine it in your scene file to handle multidimensional arrays if needed. The only requirement is that your macro swaps the data at IdxA with that at IdxB.

Parameters:

  • Array = The array containing the data being sorted.
  • IdxA, IdxB = The array offsets of the data elements being swapped.

Sort_Array(Array): This macro sorts a 1D array of floats, though you can redefine the Sort_Compare() and Sort_Swap_Data() macros to handle multidimensional arrays and other data types.

Parameters:

  • Array = The array to be sorted.

Sort_Partial_Array(Array, FirstInd, LastInd): This macro is like Sort_Array(), but sorts a specific range of an array instead of the whole array.

Parameters:

  • Array = The array to be sorted.
  • FirstInd, LastInd = The start and end indices of the range being sorted.
Personal tools
Namespaces
Variants
Actions
Content
Other Pages
Toolbox