Expand description
Point-in-solid containment via ray casting against a shell’s vertices,
edges, and faces in 3-D — the 3-D analog of super::face::face_contains.
Coincidence with the boundary is checked first (vertex, then edge, then
face — each a full pass, so a higher-priority coincidence is never
shadowed by iteration order). Otherwise a ray is cast from the query
point in a random direction (drawn from a seeded PRNG, see
super::rng::Rng), retried with a fresh direction whenever it grazes a
vertex or an edge (both ambiguous to count reliably — an edge is shared
by two faces, a vertex by several edges), until one is found whose only
crossings are clean face-interior hits. The even/odd parity of that
crossing count then gives inside/outside — this needs no consistently
oriented face normal, only a clean ray.
Structs§
- Beside
- What
solid_contains_besidefound: whether the solid is on the normal’s side of the face, and the ray that decided it, for the record. - Classified
- Points already classified against shells, each strictly inside or
outside: what
solid_containsclassifies later points from, along a short path from the nearest (seeshell_contains_from) instead of a ray across the whole shell.
Enums§
- Point
Classification - Result of classifying a query point against a shell’s boundary.
Functions§
- on_
solid_ boundary_ besides - Whether
point, a point inside faceface_idof the solidsolid_id, is on the solid’s boundary anywhere else as well: on a vertex, on an edge, or on another face, of any of its shells. A body touching the face at a point leaves a vertex of its own in the face’s interior with no topology between them: an inscribed sphere’s pole on the cube’s face. Other arguments as forshell_contains. - shell_
contains - Classify
pointagainstshell_id’s boundary:PointClassification::OnVertex/PointClassification::OnEdge/PointClassification::OnFaceif the query point itself coincides with the boundary, elsePointClassification::Inside/PointClassification::Outsidevia ray casting. - shell_
contains_ from - Like
shell_contains, fromfrom: a point already classified againstshell_id, strictly inside it (from_inside) or strictly outside. - shell_
face_ at - The face of
shell_idthatpointlies on, if any, and where on its surface: the first, in the shell’s order. - solid_
contains - Classify
pointagainst the solidsolid_id: on its boundary if on any of its shells’, else inside exactly when inside an odd number of them — inside the outer shell and no void, say — for the shells of one solid never cross. Asking each shell alone would put a point in a void inside the solid. Each shell is asked from the nearest pointclassifiedalready holds for it, if any (seeshell_contains_from), and a point found strictly inside or outside a shell is added to it. Other arguments as forshell_contains. - solid_
contains_ beside - Classifies the points of the solid
solid_idjust off its faceface_id(of its shellshell_id) on the sidenormalpoints to, atpoint, a point inside the face:insideif the solid is on that side of the face there. Other arguments as forshell_contains. - solid_
face_ at - The face of the solid
solid_idthatpointlies on, if any, and where on its surface (seeshell_face_at). - solid_
lumps - The lumps of the solid
solid_id: each shell bounding material from outside, with the voids in it. A shell is a void when inside an odd number of the solid’s other shells, and a void belongs to the innermost shell around it. Asked of each shell at one of its vertices off the other shell: shells of one solid never cross, so where one vertex is, all of it is. A solid of one shell is one lump without voids. Lumps are in the order of their shells in the solid. Other arguments as forshell_contains.