title: Find the normal "N" on an ellipses through a point on a cross section
body: <p>I'm trying to make a nice deflection effect in a little physics engine I've made. Right now it  deflects nicely off the normal of a polygon edge. But instead of making a polygon with 100 edges to get a smooth effect of a "rounded deflection" I figured I could calculate the deflection normal using an ellipse instead.</p>
  
  <p>So, what I'd really like is a function that takes a point <em>P</em> on a line segment and returns the normal <em>N</em> on the circumference of an imaginary <em>ellipse(w,h)</em>. See the attached picture for some details.</p>
  
  <p><img src="https://i.stack.imgur.com/kCAZj.png" alt="A picture of the problem"></p>
  
  <p>To get a point on the circumference of an ellipse I'm pretty sure it's:</p>
  
  <pre><code>x=P.x+Math.sin()*w
  y=P.y+Math.cos()*h
  </code></pre>
  
  <p>but how can I get the normal from that?</p>
  
  <hr>
  
  <p><a href="http://jsfiddle.net/45eFT/5/" rel="nofollow noreferrer">Here's a fiddle</a> with an attempt to implement the answer by Dr BDO Adams.</p>