GetDarkestIndices MEL

From scripting
Jump to: navigation, search
global proc int[] GetDarkestIndices(string $RGBMat[]) {
	//0001D LLC 2015 Nick Pisca
	//string $RGBMat[] = $WZ;
	int $indexNums[1] = {0,0};
	int $XEndCt = size($RGBMat);
	float $SmallestRGB = 1000000.0;
	for ($x=0;$x<$XEndCt;$x++) {
		string $YSub[] = RealTokenize($RGBMat[$x], ",");
		for ($y=0;$y<size($YSub);$y++) {
			if(float($YSub[$y]) < $SmallestRGB) {
				$SmallestRGB = float($YSub[$y]);
				$indexNums = {$x,$y};
			}
		}
	}
	return $indexNums;
}


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