angleThreshold property
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
-------5
6
---7
8
__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;