|
本帖最后由 1235813 于 2011-5-21 20:18 编辑
来至---RhinoScript.org
' ****************************** RhinoScript.org ******************************
'
' Array Library, version 1.4
'
' by Hanno Stehling, published Jun 30, 2008
'
'
' A collection of functions to make life with arrays in RhinoScript easier
'
'
'
'
' This RhinoScript Library has been downloaded from RhinoScript.org.
'
' Rhino versions: Rhino 4
'
' LICENSE INFORMATION:
' This script is published under the GNU General Public License, version 3
' or any later version, and thus comes WITHOUT ANY WARRANTY. You can get
' the complete license text here: www.rhinoscript.org/gpl
'
' ****************************** RhinoScript.org ******************************
' Array library - Version 1.4
' ---------------------------------------
' Hanno Stehling | post@hanno-stehling.de
'
' This library contains some functions to make working with arrays easier.
' Most functions are inspired by PHPs convenient array_* functions. There is
' a function list directly beneath this text. More detailed documentation is
' given directly with the code of each function.
' IMPORTANT: Nearly all functions only work with one-dimensional arrays,
' exceptions are explicitely mentioned in the documentation. You can use
' array_2to1dim() or array_3to1dim() to create a nested one-dimensional array
' from a two- or three-dimensional one.
' ALSO IMPORTANT: Many functions alter the array you feed them.
' Those arrays are marked * in the documentation (and of course passed ByRef)
' Function list:
' --------------
'
' array_dimensions: get number of array dimensions
' array_dim: dimension a one-dimensional array
' array_dim2: dimension a two-dimensional array
' array_dim3: dimension a three-dimensional array
' array_fill: dimension a one-dimensional array and fill it with a default value
' array_fill2: dimension a two-dimensional array and fill it with a default value
' array_fill3: dimension a three-dimensional array and fill it with a default value
' array_2to1dimension: convert a two-dimensional array into a nested one-dimensional array
' array_3to1dimension: convert a three-dimensional array into a nested one-dimensional array
' array_flatten: convert a nested array into a flat array
' array_flatten2: convert a two-dimensional array into a flat one-dimensional array
' array_flatten3: convert a three-dimensional array into a flat one-dimensional array
' array_swap: swaps dimensions of a two-dimensional array
' array_count: returns the number of elements in an array
' array_insert: insert a value into an array
' array_extract: extract a value from an array
' array_push: append a value to the end of an array
' array_pop: return and remove a value from the end of an array
' array_unshift: insert a value at the beginning of an array
' array_shift: return and remove a value from the beginning of an array
' array_slice: return part of an array
' array_clean: remove all elements with a given value from an array
' array_unique: remove duplicate values from an array
' array_merge: merge two or more arrays
' array_pad: expand an array to a given size and fill new elements with a default value
' array_sort: sort an array
' array_nsort: sort arrays in a nested array after the element at a given index
' array_reverse: get an array in reversed order
' array_search: search an array for a value
' array_search_neg: search an array for an element that does not equal a value
' array_min: get the minimal value found in an array
' array_max: get the maximal value found in an array
' array_sum: get the sum of all values in an array
' array_product: get the product of all values in an array
' array_rand: get the value at a random position of an array
' array_implode: implode all elements of an array to a string
' array_print: print an array to the Rhino command window
20080630_rvb_1_Array_Library_v1.4.rvb
(20.39 KB, 下载次数: 37)
|
|