{"library":"robust-in-sphere","title":"robust-in-sphere","description":"robust-in-sphere is a JavaScript library providing an exact arithmetic test to determine if a collection of `n+2` points in `n`-dimensional space are cospherical, or if the last point is contained within the sphere defined by the preceding `n+1` points. This library focuses on robust predicates to avoid floating-point errors, a common issue in computational geometry, drawing inspiration from Jonathan Shewchuk's seminal work. Currently at version 1.2.1, it was last published in 2014, suggesting a stable but not actively developed state. Its primary differentiator is the use of exact arithmetic for geometric predicates, ensuring reliability over speed for critical calculations. While not as fast as some alternatives, its exactness is crucial for applications requiring high precision in geometric computations.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install robust-in-sphere"],"cli":null},"imports":["const inSphere = require('robust-in-sphere')","const inSphere = require('robust-in-sphere'); const result = inSphere[4](p1, p2, p3, p4);"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const inSphere = require(\"robust-in-sphere\");\n\n// Example for 2D (n=2), requiring n+2 = 4 points.\n// Tests if the last point ([0, -1]) is inside the circle defined by the first three points.\n// Returns <0 if inside, >0 if outside, 0 if cospherical.\nconst result2D = inSphere(\n  [0, 1],\n  [1, 0],\n  [-1, 0],\n  [0, -1]\n);\nconsole.log(`Result for 2D points: ${result2D}`); // Should be <0 as [0,-1] is inside the circle through [0,1], [1,0], [-1,0]\n\n// Example for 3D (n=3), requiring n+2 = 5 points.\n// Using a specialized version for 5 points (inSphere[5]) if available, or generic.\n// Points for a sphere centered at origin with radius 1.\nconst p1 = [1, 0, 0];\nconst p2 = [0, 1, 0];\nconst p3 = [-1, 0, 0];\nconst p4 = [0, -1, 0];\nconst p5 = [0, 0, 0.5]; // Point inside the sphere\nconst p6 = [0, 0, 2];   // Point outside the sphere\n\nconst result3DInside = inSphere(p1, p2, p3, p4, p5);\nconsole.log(`Result for 3D point inside: ${result3DInside}`); // Should be <0\n\nconst result3DOutside = inSphere(p1, p2, p3, p4, p6);\nconsole.log(`Result for 3D point outside: ${result3DOutside}`); // Should be >0\n\nconst result3DCospherical = inSphere(p1, p2, p3, p4, [0,0,1]);\nconsole.log(`Result for 3D points cospherical: ${result3DCospherical}`); // Should be 0","lang":"javascript","description":"This quickstart demonstrates how to use `robust-in-sphere` to test point-in-sphere and cosphericity conditions for 2D and 3D points, illustrating the expected return values.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}