title: Point in plane closest to point
body: <p>I'm trying to find a point in the plane closest to a given point.
  I have the equation of the plane, the point and the distance between them.
  How do I find the point in the plane which is closest to the given point?</p>
  
  <p>I have a tetrahedron with sides:
  bcx=0, acy=0, abz=0, x/a+y/b+z/c=1 (a,b,c are not to mix with Ax+By+Cz=D in the planes equation, they are to be entered when running the script).</p>
  
  <pre><code>function [d n]=tetradist(x,y,z,a,b,c)    
  if z&gt;0 &amp;&amp; y&gt;0 &amp;&amp; x&gt;0 &amp;&amp; z&lt;c &amp;&amp; y&lt;b &amp;&amp; x&lt;a &amp;&amp; x/a+y/b+z/c&lt;1
          d1=abs(a*b*z)/sqrt((a*b)^2);
          d2=abs(b*c*x)/sqrt((b*c)^2);
          d3=abs(a*c*y)/sqrt((a*c)^2);
          d4=abs(b*c*x+a*c*y+a*b*z-a*b*c)/sqrt((b*c)^2 + (a*c)^2 + (a*b)^2);
  A = [d1 d2 d3 d4];
  B = sort(A,'ascend');
  d = B(1);
  point=[x y z];
  if d==d1
      normalv=[0 0 a*b]';
  elseif d==d2
      normalv=[b*c 0 0]';
  elseif d==d3
      normalv=[0 a*c 0]';
  else
      normalv=[b*c a*c a*b]';
  end
  end
  </code></pre>
  
  <p>So now I have the shortest distance, my point as a vector and the normal vector of the closest plane. Now how do I find the point in said plane which is closest to my point 'point'?</p>
  
  <p>Thanks in advance!</p>