pub struct SphericalRegion { /* private fields */ }Expand description
The trim of a spherical face, as directed boundary arcs on the unit sphere, ready to classify points without touching any chart or parameter domain.
Containment is decided by CROSSING PARITY against a seed the region carries: one point placed just to the material side of one boundary arc. The parity of the crossings between the seed and a query decides the query, and both the seed and the test are ordinary great-circle geometry — no parameter domain, no pole, no seam, and no reliance on a signed-area formula whose branch collapses when the query sits opposite a small loop (which is exactly the near-tangent pocket, and exactly where it was wrong).
The seed encodes the BREP convention in the one place it belongs: material lies to the LEFT of the directed boundary as seen from the FACE normal — the face’s own normal, which for a cavity wall points into the sphere, not out of it.
Implementations§
Source§impl SphericalRegion
impl SphericalRegion
Sourcepub fn new(
centre: Vec3,
polylines: &[Vec<Vec3>],
outward_face_normal: bool,
) -> Self
pub fn new( centre: Vec3, polylines: &[Vec<Vec3>], outward_face_normal: bool, ) -> Self
Build the region from the face’s trim loops given as closed 3D polylines.
outward_face_normal says whether the FACE’s normal points out of the
sphere — same_sense == parameterization_is_outward, never same_sense
alone and never the surface normal alone.
Sourcepub fn from_segments(
centre: Vec3,
segments: &[(Vec3, Vec3)],
outward_face_normal: bool,
) -> Self
pub fn from_segments( centre: Vec3, segments: &[(Vec3, Vec3)], outward_face_normal: bool, ) -> Self
As Self::new, from the directed boundary segments themselves.
A consumer that has one loop joining TWO rims through the seam — a ball drilled through — MUST use this: concatenating that loop’s surviving coedges and closing the ring bridges rim to rim with two chords that are not reverses of each other, and the region that comes out is not the one the face means.
Sourcepub fn is_whole_sphere(&self) -> bool
pub fn is_whole_sphere(&self) -> bool
Whether the face has no material boundary at all — an untrimmed ball, whose only “loops” were the seam slit and the two collapsed poles.
Sourcepub fn is_decidable(&self) -> bool
pub fn is_decidable(&self) -> bool
Whether this region can answer at all: either it has no boundary, or the seed search cleared one.
A region with arcs but no seed must make its CALLER decline — answering anyway would report every point material, which in the mesh is silent double coverage and in the trim query is a face that swallowed the ball. A classifier that cannot decide has to say so.
Sourcepub fn contains(&self, centre: Vec3, point: Vec3) -> bool
pub fn contains(&self, centre: Vec3, point: Vec3) -> bool
Whether the sphere point point is material. Pole-free and seam-free:
the query never enters a parameter domain.
Sourcepub fn separation(&self, centre: Vec3, point: Vec3) -> usize
pub fn separation(&self, centre: Vec3, point: Vec3) -> usize
How many boundary arcs separate point from the region’s seed. A caller
letting one probe speak for a whole flood region prefers the probe whose
count is smallest — it is the one furthest from a grazing arc.
Trait Implementations§
Source§impl Clone for SphericalRegion
impl Clone for SphericalRegion
Source§fn clone(&self) -> SphericalRegion
fn clone(&self) -> SphericalRegion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more