// =========================================================================== // 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. // =========================================================================== // // // // // float[] floatArrayRemove(float[] $item, float[] $list) // // // Remove the float items in the first float array from the // second float array. A new float array with the // items removed is returned. The second argument is left // unchanged. //

// Note that all occurrences of the given // float items will be removed from the float array, not // just the first occurrence. // // // float[] $items A list of float values to remove from the float array. // float[] $list The array to be acted upon. // // // float[] : Original list with all occurrences of the float items // removed. If none of the float items are in the float array then // the returned float array is identical to the argument float array. // // // float $list[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; // float $items[] = { 1.0, 3.0, 5.0, 7.0 }; // float $diff[] = floatArrayRemove($items, $list); // // Result : { 2, 4, 6, 8 } // // // // global proc float [] floatArrayRemove( float $items[], float $list[] ) { float $item, $listItem, $result[]; int $keep, $resultIndex = 0; for ($listItem in $list) { $keep = 1; for ($item in $items) { if ($item == $listItem) { $keep = 0; break; } } if ($keep) $result[$resultIndex++] = $listItem; } return $result; }