import Foundation import CoreGraphics /// Maps a measured round-trip time (ms) to a radial distance from downtown. /// A log curve so the busy near range (1–50ms LAN/CDN) spreads out instead of /// bunching at the center, while the long tail (transcontinental) saturates. public enum LatencyLayout { public static let minRadius: CGFloat = 150 public static let maxRadius: CGFloat = 560 public static let rttCeiling: Double = 250 // ms mapped to the outer edge public static func radius(forRTT rtt: Double) -> CGFloat { let clamped = max(0, min(rtt, rttCeiling)) let norm = log10(1 + clamped) / log10(1 + rttCeiling) return minRadius + CGFloat(norm) * (maxRadius - minRadius) } }