GetDarkestIndices MEL

From scripting
Revision as of 05:42, 22 April 2017 by Nickpisca (talk | contribs) (Created page with " global proc int[] GetDarkestIndices(string $RGBMat[]) { //0001D LLC 2015 Nick Pisca //string $RGBMat[] = $WZ; int $indexNums[1] = {0,0}; int $XEndCt = size($RGBMat);...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.