title: Perpendicular on a line segment from a given point
body: <p>I want to calculate a point on a given line that is perpendicular from a given point. </p>
  
  <p>I have a line segment AB and have a point C outside line segment. I want to calculate a point D on AB such that CD is perpendicular to AB.</p>
  
  <p><img src="https://i.stack.imgur.com/vgsm5.png" alt="Find point D"></p>
  
  <p>I have to find point D. </p>
  
  <p>It quite similar to <a href="https://stackoverflow.com/questions/1811549/perpendicular-on-a-line-from-a-given-point">this</a>, but I want to consider to Z coordinate also as it does not show up correctly in 3D space.</p>