tinycodinglm / math /math-0172.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
1.29 kB
{"type": "session", "harness": "opencode", "id": "math-0172", "name": "Geometric Primitives and Operations"}
{"type": "message", "message": {"role": "system", "content": "You are an expert mathematician and programmer."}}
{"type": "message", "message": {"role": "user", "content": "Explain geometric primitives for programming"}}
{"type": "message", "message": {"role": "assistant", "content": "struct Point { double x,y; };\ndot = a.x*b.x+a.y*b.y; cross = a.x*b.y-a.y*b.x;\nlen = sqrt(dot(a,a)); dist = sqrt(dot(a-b,a-b));\n\nLines: ax+by=c. Two-point form: cross(b-a,p-a)=0 for point p on line through a,b.\nIntersection of two lines (a1,b1,c1) and (a2,b2,c2): det=a1*b2-a2*b1. x=(c1*b2-c2*b1)/det, y=(a1*c2-a2*c1)/det.\n\nSegment intersection: check bounding boxes overlap, then cross products for proper intersection.\nPoint on segment: collinear and within bounding box.\n\nPolygon: vector of points. Area via shoelace. Contains point: ray casting (count crossings with ray from point).\n\nConvex polygon: all left turns. Binary search for point inside (monotone chain).\n\nCircle: center (cx,cy), radius r. Area = pi*r^2. Point in circle: dist <= r.\nInscribed circle: intersection of angle bisectors.\n\nEpsilon comparisons: fabs(a-b) < 1e-9 for floating point equality."}}