Difference between revisions of "GetDarkestVector MEL"
From scripting
(Created page with " global proc vector GetDarkestVector(vector $CurPos, float $Rad, int $NumTests, string $File) { //0001D LLC 2015 Nick Pisca //vector $CurPos = <<0.1,0.1,0.0>>; float $Rad =...") |
(No difference)
|
Latest revision as of 05:55, 22 April 2017
global proc vector GetDarkestVector(vector $CurPos, float $Rad, int $NumTests, string $File) { //0001D LLC 2015 Nick Pisca //vector $CurPos = <<0.1,0.1,0.0>>; float $Rad = 0.1; int $NumTests = 5; string $File = "file1"; vector $WinVec = <<0.0,0.0,0.0>>; float $WinF = 10000000.0; for ($x=0;$x<$NumTests;$x++) { float $rx = rand(-$Rad,$Rad); float $ry = rand(-$Rad,$Rad); vector $rvec = <<$rx, $ry, 0.0>>; vector $runit = unit($rvec); vector $rrel = $Rad * $runit; vector $rwin = $CurPos + $rrel; $rwin = <<abs(($rwin.x)),abs(($rwin.y)),0.0>>; float $rdb[] = `colorAtPoint -u ($rwin.x) -v ($rwin.y) $File`; if ($rdb[0] < $WinF) { $WinF = $rdb[0]; $WinVec = $rwin; } } return $WinVec; }
More information on polygon vertex manipulation, read pages 113-116 in YSYT.