title: calculate turning points / pivot points in trajectory (path)
body: <p>I'm trying to come up with an algorithm that will determine turning points in a trajectory of x/y coordinates. The following figures illustrates what I mean: green indicates the starting point and red the final point of the trajectory (the entire trajectory consists of ~ 1500 points):
  <img src="https://i.stack.imgur.com/SI8MB.png" alt="trajectory"></p>
  
  <p>In the following figure, I added by hand the possible (global) turning points that an algorithm could return:</p>
  
  <p><img src="https://i.stack.imgur.com/bksJu.png" alt="trajectory with possible turning points"></p>
  
  <p>Obviously, the true turning point is always debatable and will depend on the angle that one specifies that has to lie between points. Furthermore a turning point can be defined on a global scale (what I tried to do with the black circles), but could also be defined on a high-resolution local scale. I'm interested in the global (overall) direction changes, but I'd love to see a discussion on the different approaches that one would use to tease apart global vs local solutions. </p>
  
  <p>What I've tried so far:</p>
  
  <ul>
  <li>calculate distance between subsequent points</li>
  <li>calculate angle between subsequent points</li>
  <li>look how distance / angle changes between subsequent points</li>
  </ul>
  
  <p>Unfortunately this doesn't give me any robust results. I probably have too calculate the curvature along multiple points, but that's just an idea.
  I'd really appreciate any algorithms / ideas that might help me here. The code can be in any programming language, matlab or python are preferred.</p>
  
  <p><strong>EDIT</strong> here's the raw data (in case somebody want's to play with it):</p>
  
  <ul>
  <li><a href="http://www.speedyshare.com/8CgN2/bla.mat" rel="noreferrer">mat file</a></li>
  <li><a href="http://www.speedyshare.com/nx8Er/bla.data" rel="noreferrer">text file</a> (x coordinate first, y coordinate in second line)</li>
  </ul>