// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // // int floatArrayFind(float $item, int $index, float[] $list) // // // Return the index of item if it is in the array and -1 otherwise. // // The array may contain more than one occurrence of the item. // This procedure will return the index of the first occurence of // item starting at index. // // // float $item The float item to search for in the float array. // float $index The array index to begin the search at // float[] $list A list of float values. // // // int : The index of the item if it is in the array and -1 otherwise. // // // float $array1[] = { 1.0, 2.0, 3.0 }; // // ,Result:, 1.0 2.0 3.0 // // int $index = floatArrayFind( 1.0, 0, $array1 ); // // ,Result:, 0 // // $index = floatArrayFind( 2.0, 0, $array1 ); // // ,Result:, 1 // // $index = floatArrayFind( 3.0, 4, $array1 ); // // ,Result:, -1 // // $index = floatArrayFind( 0.0, 0, $array1 ); // // ,Result:, -1 // // // global proc int floatArrayFind( float $item, int $index, float $list[] ) { if ( $index >= 0 ) { int $i; for ( $i=$index; $i