Difference between revisions of "GetClosestIndex MEL"
From scripting
(Created page with " global proc int GetClosestIndex(string $LocArr[], vector $XYZArr[], vector $CurVec, int $Skip[]) { //0001D LLC 2015 Nick Pisca float $WinDist = 1000000.0; int $WinInt =...") |
(No difference)
|
Latest revision as of 05:41, 22 April 2017
global proc int GetClosestIndex(string $LocArr[], vector $XYZArr[], vector $CurVec, int $Skip[]) { //0001D LLC 2015 Nick Pisca float $WinDist = 1000000.0; int $WinInt = -1; for ($x=0;$x<size($LocArr);$x++) { if (IsInIntArray($Skip, $x) == 0) { vector $Diff = $XYZArr[$x] - $CurVec; float $Dmag = mag($Diff); if ($Dmag < $WinDist) { $WinDist = $Dmag; $WinInt = $x; } } } return $x; }
More information on strings and arrays, read pages 28-37 in YSYT.