code: function getDirectionChange(angle1, angle2) {
  
          var directionChange = Math.abs(angle1 - angle2);
          return (directionChange > 180) ? (360 - directionChange) : directionChange;
      }
docs: return the change in direction between two direction angles