intersection = CGA3D.inline((extract_detailed) => {
const ei = 1e5 + 1e4;
const eo = .5 * (1e5 - 1e4);
const E = ei^eo;
const eq = (a,b) => a-b == 0;
const pt = (x,y,z) => x*1e1 + y*1e2 + z*1e3 + .5*(x*x+y*y+z*z)*ei + eo;
const extract = pp => {
const r = Math.sqrt(Math.abs((pp << pp)[0]));
const le = pp << (ei^pp) - (pp << pp)*ei;
const ri = r*(ei << pp);
const denom = (ei << pp)**2;
return [
-(le - ri) / denom,
-(le + ri) / denom,
];
};
var sphere1 = pt(3,0,-.5)^pt(-1,0,-.5)^pt(1,2,-.5)^pt(1,0,1.5);
var sphere2 = pt(3,0,1)^pt(-1,0,1)^pt(1,2,1)^pt(1,0,3);
var line = pt(0,0,0)^pt(1,0,0)^ei;
var intersection1 = (sphere1&line);
return extract(intersection1);
var sphere3 = pt(4,1,0)^pt(0,1,0)^pt(2,3,0)^pt(2,1,2);
var intersection2 = (sphere3&sphere2&sphere1);
return extract(intersection2);
return [intersection1, intersection2, (sphere1&sphere2)];
})(extract_detailed)