Difference between revisions of "IsWithDistByString MEL"

From scripting
Jump to: navigation, search
(Created page with " global proc int IsWithDistByString(string $SkipStrArr[], vector $TestVec, float $Rad) { //0001D LLC 2015 Nick Pisca //string $SkipStrArr[] = {"0.888,0.777","0.555,0.6"};...")
 
(No difference)

Latest revision as of 07:05, 22 April 2017

global proc int IsWithDistByString(string $SkipStrArr[], vector $TestVec, float $Rad) {
	//0001D LLC 2015 Nick Pisca
	//string $SkipStrArr[] = {"0.888,0.777","0.555,0.6"}; vector $TestVec = <<0.996,0.428,0.0>>; float $Rad = .25;
	for ($x=0;$x<size($SkipStrArr);$x++) {
		string $DestUVs[];
		$numTokens = `tokenize $SkipStrArr[$x] "," $DestUVs`;
		vector $TempVec = <<float($DestUVs[0]),float($DestUVs[1]),0.0>>;
		vector $TDiff = $TempVec - $TestVec;
		float $TDist = mag($TDiff);
		if ($TDist < $Rad) {
			return 1;
		}
	}
	return 0;
}


More information on vectors and arrays, read pages 12-16 in YSYT.