Guest
Public paste!

bi

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 0.59 KB | Hits: 71 | Expires: Never
Copy text to clipboard
  1. proc float getPointPlaneDistance(string $planeName, string $nameLoc)
  2. {
  3.         float $planeEq[] = `getPlaneEquation($planeName)`;
  4.         float $loc[] = `xform -ws -q -t $nameLoc`;
  5.  
  6.         float $dividend = ( ($planeEq[0] * $loc[0]) + ($planeEq[1] * $loc[1]) + ($planeEq[2] * $loc[2]) + $planeEq[3]);
  7.        
  8.         print ("\n dividend \n");
  9.         print $dividend;
  10.         float $divisor = (sqrt(($planeEq[0]*$planeEq[0]) + ($planeEq[1]*$planeEq[1]) + ($planeEq[2]*$planeEq[2])));
  11.         float $dist = ($dividend)/($divisor);
  12.        
  13.         print ("\n distance from point to plane \n");
  14.         print $dist;
  15.  
  16.         //returns float distance
  17.         return $dist;
  18.        
  19. }