|
Download math/math-0170.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/7fe6853bcbe998c7aec3aa0f7086f584cc091586/math/math-0170.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm@7fe6853bcbe998c7aec3aa0f7086f584cc091586/math/math-0170.jsonl
-
curl -L -o math-0170.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/7fe6853bcbe998c7aec3aa0f7086f584cc091586/math/math-0170.jsonl
1.31 kB
| {"type": "session", "harness": "opencode", "id": "math-0170", "name": "Computational Geometry: Polygons"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert mathematician and programmer."}} | |
| {"type": "message", "message": {"role": "user", "content": "Explain polygon algorithms for computational geometry"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "Polygon: list of vertices in order (CW or CCW).\n\nArea (shoelace formula): A = 0.5 * |sum(x_i * y_{i+1} - x_{i+1} * y_i)|. Positive=CCW, negative=CW.\n\nPerimeter: sum of edge lengths.\n\nPoint in polygon:\n- Ray casting: shoot ray from point, count edge crossings. Odd=inside, even=outside.\n- Winding number: count signed angle traversed around point. Non-zero=inside.\n\nConvex hull:\n- Graham scan: sort by angle from lowest point, maintain stack, pop on right turn. O(n log n).\n- Monotone chain: sort by x then y, build upper/lower hull. O(n log n). Simpler.\n- Jarvis march: gift wrapping. O(nh) where h=hull size. Good when h is small.\n\nPolygon triangulation: ear clipping O(n^2). For convex: fan from vertex 0.\n\nRotating calipers: find diameter, width, minimum bounding rectangle of convex polygon in O(n).\n\nMinkowski sum: sum of two convex polygons. O(n+m). Used for collision detection."}} | |