Fast algorithm to calculate the circumcircle of a 2D triangle.
npm install circumcircle
const circumcircle = require('circumcircle');
const points = [ [0.0, -0.5], [0.5, 0.5], [-0.5, 0.5] ];
console.log(circumcircle(points));
Output:
{ x: 0, y: 0.125, r: 0.625 }
-
points
an array with 3 points[ [x,y], [x,y], [x,y] ]
-
radiusSq
returns the radius squared - faster because it skipsMath.sqrt()
Returns an object with circumcenter and circumradius { x, y, r }
Lingjia Liu and Joseph O'Rourke
MIT, see LICENSE for details.