code: private MarkerVector  realignMarkerMid(MarkerVector lastPos, MarkerVector thisPos, MarkerVector nextPos)
     {
        // Check the temporary marker vector against the incoming vector
        float  dot = dotProduct(thisPos.dx, thisPos.dy, (thisPos.x - lastPos.x), (thisPos.y - lastPos.y));
        if (dot == 0f) {
           // Those two were perpendicular, so instead try the outgoing vector
           dot = dotProduct(thisPos.dx, thisPos.dy, (nextPos.x - thisPos.x), (nextPos.y - thisPos.y));
        }
        if (dot > 0)
           return thisPos;
        if (dot == 0f) {
           // If that was perpendicular also, then give up.
           // Else use the one that points in the same direction as 0deg (1,0) or has non-negative y.
           if (thisPos.dx > 0f || thisPos.dy >= 0)
              return thisPos;
        }
        // Reverse this vector and point the marker in the opposite direction.
        thisPos.dx = -thisPos.dx;
        thisPos.dy = -thisPos.dy;
        return thisPos;
     }
docs: /*
  This was one of the ambiguous markers. Try to see if we can find a better direction for
  it, now that we have more info available on the neighbouring marker positions.