computeConfidence static method

double computeConfidence(
  1. double offRouteDistance
)

E5: Sigmoid Confidence (Google Maps standard) Midpoint of 9.0m ensures standard lane variations (0-6m) remain snapped (>80%), while lateral deviations towards parallel frontage roads (>10m) release snapping so the vehicle marker accurately follows the actual frontage road.

Implementation

static double computeConfidence(double offRouteDistance) {
  const midpoint = 9.0;
  const steepness = 0.35;
  return 1.0 / (1.0 + math.exp(steepness * (offRouteDistance - midpoint)));
}