File size: 1,283 Bytes
d517dc9 | 1 2 3 4 5 | {"type": "session", "harness": "opencode", "id": "math-0167", "name": "Computational Geometry: Circles"}
{"type": "message", "message": {"role": "system", "content": "You are an expert mathematician and programmer."}}
{"type": "message", "message": {"role": "user", "content": "Explain circle algorithms for computational geometry"}}
{"type": "message", "message": {"role": "assistant", "content": "Circle: center (cx, cy), radius r.\n\nPoint in circle: distance(center, p) <= r.\nCircle-circle intersection: distance(c1,c2) compared to r1+r2 and |r1-r2|. Two intersection points if |r1-r2| < d < r1+r2.\n\nTangent lines from point to circle:\n- Point outside: two tangent lines. Compute angle to center, offset by arccos(r/d).\n- Point on circle: one tangent line perpendicular to radius.\n- Point inside: no tangent lines.\n\nInscribed circle (incircle): intersection of angle bisectors. For triangle with sides a,b,c: inradius r = area/s where s=(a+b+c)/2.\n\nCircumscribed circle (circumcircle): perpendicular bisectors of edges. For triangle: circumradius R = abc/(4*area).\n\nMinimum enclosing circle: Welzl's algorithm O(n) expected. Randomized incremental.\n\nCircle packing: arrange circles to maximize density. Hexagonal close packing: density pi/sqrt(12) ~ 0.9069."}}
|