# IsVectorInArrayWithinDistance

From scripting

vector $TTArr[]; $TTArr[0] = <<2,3,22>>; $TTArr[1] = <<2,-3,22>>; $TTArr[2] = <<-2,3,22>>; vector $MArr = <<22,23,22>>; int $HHH = IsVectorInArrayWithinRange($MArr, $TTArr,111); global proc int IsVectorInArrayWithinRange(vector $MainVec, vector $MainVecArr[], float $RangeVal) { //Author Nick Pisca 0001d 2009 int $WC = 0; int $WCBool = 0; do { vector $MVA = $MainVecArr[$WC]; vector $Diff = $MainVec - $MVA; float $DVal = mag($Diff); if ($RangeVal > $DVal) { $WCBool = 1; } $WC++; } while ($WC<size($MainVecArr) && $WCBool==0); return $WCBool; }

*More information on vectors and vector mathematics, read pages 14-16, 20-21 in YSYT.*