Skip to main content

SphericalRegion

Struct SphericalRegion 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> SphericalRegion

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SphericalRegion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SphericalRegion

Source§

fn default() -> SphericalRegion

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more