{"version":"1.0","type":"rich","title":"line-intersection","description":"This interactive visualization demonstrates the Bentley–Ottmann algorithm for finding line segment intersections. Users can drag line endpoints to reposition them, click to add new segments, and right-click to remove them. The algorithm sweeps a horizontal line from top to bottom, maintaining the order of segment x-positions at the current y (shown in the right panel). Instead of checking all O(n²) segment pairs, only adjacent segments are tested for intersections as they start, end, or cross, yielding O(n log n + I log n) time for I intersections. The SVG rendering highlights intersection points as they are discovered, providing an intuitive view of the sweep-line process.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-70b94260e227098fcca7caa069768655?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}