angleThreshold property

double angleThreshold
final

Set the tolerance to skip consecutive Location value in the queue running in the same direction:

If absolute angle/heading different between current,next location° and next location, after next location° is less than angleThreshold next location will get skipped and so on.

Ex: Let's imagine that the square bracket are location in the queue and dash(-) for 180° and underscore(_) for 189°

1---------2---3----4-------56---78__9---10 1--------------------------------5__6---7_______9---10

All the consecutive location in the same direction with angle/heading different/delta less than angleThreshold will get skipped:

2,3,4 for 180°. 8 for 189°

Using angleThreshold can prevent unnecessary stops and delay between first location in the queue and the current user location.

Set to zero if you don't want to missed any stop.


  var delta = afterNextAngle - currentAngle;

  if (delta.abs() < threshold) {
        next.remove();
  }

Very very small angle (<1e-6) can led to errors.

Implementation

final double angleThreshold;