Skip to main content

Module shell

Module shell 

Source
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_beside found: 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_contains classifies later points from, along a short path from the nearest (see shell_contains_from) instead of a ray across the whole shell.

Enums§

PointClassification
Result of classifying a query point against a shell’s boundary.

Functions§

on_solid_boundary_besides
Whether point, a point inside face face_id of the solid solid_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 for shell_contains.
shell_contains
Classify point against shell_id’s boundary: PointClassification::OnVertex / PointClassification::OnEdge / PointClassification::OnFace if the query point itself coincides with the boundary, else PointClassification::Inside/PointClassification::Outside via ray casting.
shell_contains_from
Like shell_contains, from from: a point already classified against shell_id, strictly inside it (from_inside) or strictly outside.
shell_face_at
The face of shell_id that point lies on, if any, and where on its surface: the first, in the shell’s order.
solid_contains
Classify point against the solid solid_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 point classified already holds for it, if any (see shell_contains_from), and a point found strictly inside or outside a shell is added to it. Other arguments as for shell_contains.
solid_contains_beside
Classifies the points of the solid solid_id just off its face face_id (of its shell shell_id) on the side normal points to, at point, a point inside the face: inside if the solid is on that side of the face there. Other arguments as for shell_contains.
solid_face_at
The face of the solid solid_id that point lies on, if any, and where on its surface (see shell_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 for shell_contains.