GetDistBetwTwoCurves MEL
From scripting
global proc float GetDistBetwTwoCurves(string $InputCrv, string $InputCrv2, float $Divs) { //Wing, Eric, Nick 2010 //string $InputCrv = "transform95"; string $InputCrv2 = "transform94"; float $Divs = 3.0; string $SNode[] = `listRelatives($InputCrv)`; int $getspans = `getAttr($SNode[0]+".spans")`; string $SNode2[] = `listRelatives($InputCrv2)`; int $getspans2 = `getAttr($SNode2[0]+".spans")`; int $MaxCt1 = $Divs * $getspans; int $MaxCt2 = $Divs * $getspans2; float $Winner = 10000000; for ($x=0;$x<$MaxCt1;$x++) { float $xval = float($x)/(float($Divs)); float $xpos[] = `pointPosition($InputCrv + ".u[" + ($xval) + "]")`; vector $xvec = <<$xpos[0],$xpos[1],$xpos[2]>>; for ($y=0;$y<$MaxCt2;$y++) { float $yval = float($y/$Divs); float $ypos[] = `pointPosition($InputCrv2 + ".u[" + ($yval) + "]")`; vector $yvec = <<$ypos[0],$ypos[1],$ypos[2]>>; vector $diff = $xvec - $yvec; float $dmag = mag($diff); if ($dmag < $Winner) { $Winner = $dmag; } } } return $Winner; }