Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

bi

By: a guest on Feb 9th, 2010  |  syntax: None  |  size: 0.59 KB  |  hits: 71  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  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. }