File size: 1,308 Bytes
d517dc9 | 1 2 3 4 5 | {"type": "session", "harness": "opencode", "id": "math-0166", "name": "Computational Geometry: 3D Operations"}
{"type": "message", "message": {"role": "system", "content": "You are an expert mathematician and programmer."}}
{"type": "message", "message": {"role": "user", "content": "Explain 3D computational geometry"}}
{"type": "message", "message": {"role": "assistant", "content": "3D point/vector: (x, y, z).\n\nCross product: a x b = (a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x). Magnitude = area of parallelogram.\n\nDot product: a.b = a.x*b.x + a.y*b.y + a.z*b.z.\n\nVolume of tetrahedron: |dot(a, cross(b, c))| / 6.\n\nPlane: ax+by+cz=d. Normal (a,b,c). Point-normal: dot(n, p-p0)=0.\n\nLine-plane intersection: substitute parametric line into plane equation.\n\nRay-triangle intersection: Moller-Trumbore algorithm. Uses barycentric coordinates.\n\nSphere: center + radius. Point in sphere: dist <= r.\n\n3D convex hull: gift wrapping O(n^2) or incremental O(n log n). Commonly used: QuickHull.\n\nAABB (axis-aligned bounding box): min/max corners. Fast intersection test.\n\nOBB (oriented bounding box): center + 3 axes + extents. SAT (separating axis theorem) for collision.\n\nBarycentric coordinates: point = u*A + v*B + w*C where u+v+w=1. For triangles: u,v,w >= 0 means inside."}}
|