{"library":"robust-segment-intersect","title":"Robust Line Segment Intersection","description":"This library, `robust-segment-intersect`, provides an exact arithmetic predicate to rigorously determine if two closed 2D line segments intersect. It is designed to overcome floating-point inaccuracies common in geometric computations, ensuring reliable results even in degenerate cases where endpoints are collinear or nearly so. The current stable version is 1.0.1, last published in 2014. As an older package, it is considered abandoned, meaning active development and new features are unlikely, though it remains functional for its specific purpose. Its primary differentiator lies in its 'exact arithmetic' approach, which prioritizes correctness over raw speed for applications requiring absolute precision in geometric intersection tests, such as CAD, GIS, and advanced rendering algorithms. Users should be aware of its CommonJS module format and consider its age when integrating into modern projects.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install robust-segment-intersect"],"cli":null},"imports":["const crosses = require(\"robust-segment-intersect\")","import crosses from \"robust-segment-intersect\"","const intersect = require(\"robust-segment-intersect\");\nintersect(a0, a1, b0, b1);"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const crosses = require(\"robust-segment-intersect\")\n\nconst a0 = [-1, 0]\nconst a1 = [ 1, 0]\nconst b0 = [ 0,-1]\nconst b1 = [ 0, 1]\n\n// Check if line segment [a0, a1] crosses segment [b0, b1]\nconst doCross = crosses(a0, a1, b0, b1);\nconsole.log(`Segments intersect: ${doCross}`); // Expected: true\n\nconst c0 = [0, 0];\nconst c1 = [1, 1];\nconst d0 = [0, 1];\nconst d1 = [1, 0];\nconst doCross2 = crosses(c0, c1, d0, d1);\nconsole.log(`Segments intersect: ${doCross2}`); // Expected: true (cross at [0.5, 0.5])","lang":"javascript","description":"Demonstrates how to import the `robust-segment-intersect` function and use it to check for intersection between two 2D line segments defined by their endpoints.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}