title: Vertex shading and calculating lighting vector effect
body: <p>Given a triangle vertex defined with three 3D points, how do you calculate the angle between it and a given point.</p>
  
  <pre><code>class Point3D
  {
      double x, y, z;
  }
  
  class Vertex
  {
       Point3D P1, P2, P3;
  }
  
  Point3D LightPoint;
  </code></pre>
  
  <p><a href="http://www.ianquigley.com/iq/RandomImages/vextor.png" rel="nofollow noreferrer">http://www.ianquigley.com/iq/RandomImages/vextor.png</a></p>
  
  <p>Light point in Red. Blue points - triangle with the surface normal shown.</p>
  
  <p>I need to calculate the surface normal, and the angle between that and the LightPoint. I've found a few bits a pieces but nothing which puts it together.</p>