Skip to main content

PreparedRegionView2

Struct PreparedRegionView2 

Source
pub struct PreparedRegionView2<'a> { /* private fields */ }
Expand description

A borrowed region view with cached contour and region bounding boxes.

This is useful when many points or intersection queries are run against the same region. The cached boxes are only broad-phase filters: a decided point miss contributes no depth, decided disjoint contour boxes skip intersection candidates, and hits or uncertain boxes still run exact topology. Build the prepared view with the same policy family used for later queries so arc extrema and coordinate ordering are interpreted consistently.

Implementations§

Source§

impl<'a> PreparedRegionView2<'a>

Source

pub fn from_region(region: &'a Region2, policy: &CurvePolicy) -> Self

Builds a prepared view from an owned region.

Source

pub fn from_region_view(region: &RegionView2<'a>, policy: &CurvePolicy) -> Self

Builds a prepared view from a borrowed region view.

Source

pub const fn region_box(&self) -> Option<&Aabb2>

Returns the cached whole-region box when every contour box was decided.

Source

pub fn material_contours(&self) -> &[&'a Contour2]

Returns material contours in the prepared view.

Source

pub fn hole_contours(&self) -> &[&'a Contour2]

Returns hole contours in the prepared view.

Source

pub fn as_region_view(&self) -> RegionView2<'a>

Reconstructs a borrowed ordinary region view over the same contours.

The returned view is cheap and keeps the same contour lifetimes. It is useful when an algorithm still needs the canonical RegionView2 shape for splitting or cloning, while prepared classifiers supply repeated point and event queries.

Source

pub fn prepared_material_contours(&self) -> &[PreparedContourView2<'a>]

Returns prepared material contours in region-bin order.

Source

pub fn prepared_hole_contours(&self) -> &[PreparedContourView2<'a>]

Returns prepared hole contours in region-bin order.

Source

pub const fn facts(&self) -> &RegionFacts

Returns conservative structural facts collected while preparing.

Structural-dispatch note: this is where future region-level convexity, contour orientation certainty, all-line/all-arc partitioning, common scales, and symbolic dependencies should be shared with Boolean and containment algorithms without leaking scalar representation details.

Source

pub fn classify_point( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<RegionPointLocation>

Classifies a point against this prepared region view.

Source

pub fn signed_depth( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<i32>

Returns signed containment depth for a non-boundary point.

This follows the same signed material-minus-hole convention as RegionView2::signed_depth. Decided cached-box misses are skipped, then candidate contours are classified with the boundary-first winding structure described by Hormann and Agathos, “The Point in Polygon Problem for Arbitrary Polygons” (2001), with this crate’s circular-arc extension.

Source

pub fn intersect_prepared_region( &self, other: &PreparedRegionView2<'_>, policy: &CurvePolicy, ) -> CurveResult<RegionIntersectionSet>

Collects normalized topology events against another prepared region.

This reuses cached contour and segment boxes for the candidate phase and then delegates candidate pairs to the same exact line/arc intersection normalization as RegionView2::intersect_region. The cache changes the amount of repeated broad-phase work, not the topology contract.

Source

pub fn intersect_region( &self, other: &RegionView2<'_>, policy: &CurvePolicy, ) -> CurveResult<RegionIntersectionSet>

Collects normalized topology events against an ordinary region view.

Source

pub fn boolean_boundary_loops( &self, other: &PreparedRegionView2<'_>, op: BooleanOp, policy: &CurvePolicy, ) -> CurveResult<Classification<BooleanBoundaryLoopSet>>

Computes closed boolean boundary loops against another prepared region.

This prepared path runs the same split, classify, and boundary-chain traversal as RegionView2::boolean_boundary_loops, but reuses cached region/contour boxes during event collection and fragment midpoint classification. Greiner and Hormann describe closed boundary traversal after intersection insertion and entry/exit classification (G. Greiner and K. Hormann, “Efficient clipping of arbitrary polygons,” 1998); Martinez, Rueda, and Feito describe boolean selection from classified segments (F. Martinez, A. J. Rueda, and F. R. Feito, “A new algorithm for computing Boolean operations on polygons,” 2009). Cached boxes only prune decided misses, so boundary and overlap uncertainty is preserved.

Source

pub fn boolean_boundary_loops_against_region( &self, other: &RegionView2<'_>, op: BooleanOp, policy: &CurvePolicy, ) -> CurveResult<Classification<BooleanBoundaryLoopSet>>

Computes closed boolean boundary loops against an ordinary region view.

This is a mixed prepared/unprepared convenience path: the left operand’s cache is reused, the right operand is prepared for this call, and the prepared-prepared traversal described in PreparedRegionView2::boolean_boundary_loops remains authoritative. The transient right-side cache follows the same candidate-pruning role as Bentley and Ottmann’s broad-phase intersection reporting setup, while the final boundary traversal still follows the Greiner-Hormann and Martinez-Rueda-Feito split/classify/assemble model cited above.

Source

pub fn boolean_boundary_contours( &self, other: &PreparedRegionView2<'_>, op: BooleanOp, fill_rule: FillRule, policy: &CurvePolicy, ) -> CurveResult<Classification<Vec<Contour2>>>

Computes checked boolean boundary contours against another prepared region.

This extends PreparedRegionView2::boolean_boundary_loops through the same checked-contour conversion and regularized contact fast paths used by RegionView2::boolean_boundary_contours. The prepared parts remain candidate filters only: Foster, Hormann, and Popa’s degenerate clipping cases still surface as explicit boundary handling rather than as tolerance-based inside/outside choices.

Source

pub fn boolean_boundary_contours_against_region( &self, other: &RegionView2<'_>, op: BooleanOp, fill_rule: FillRule, policy: &CurvePolicy, ) -> CurveResult<Classification<Vec<Contour2>>>

Computes checked boolean boundary contours against an ordinary region view.

This prepares the right operand only for the duration of the call and then uses PreparedRegionView2::boolean_boundary_contours. Keeping the wrapper explicit makes one-prepared/many-unprepared workloads ergonomic without weakening the degenerate clipping behavior described by Foster, Hormann, and Popa for boundary contacts.

Source

pub fn boolean_region( &self, other: &PreparedRegionView2<'_>, op: BooleanOp, fill_rule: FillRule, policy: &CurvePolicy, ) -> CurveResult<Classification<Region2>>

Computes a role-assigned boolean region against another prepared region.

This is the prepared analogue of RegionView2::boolean_region. It reuses cached event and point-classification broad phases before returning to the ordinary contour-nesting pass for final material/hole assignment, preserving the Vatti-style fill-state semantics already used by the non-prepared region pipeline.

Source

pub fn boolean_region_against_region( &self, other: &RegionView2<'_>, op: BooleanOp, fill_rule: FillRule, policy: &CurvePolicy, ) -> CurveResult<Classification<Region2>>

Computes a role-assigned boolean region against an ordinary region view.

The right operand is prepared transiently, after which the same prepared boolean-region path assigns resolved contours to material and hole bins. The nesting step remains the Hormann-Agathos boundary-first point classification used by RegionView2::boolean_region.

Trait Implementations§

Source§

impl<'a> Clone for PreparedRegionView2<'a>

Source§

fn clone(&self) -> PreparedRegionView2<'a>

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<'a> Debug for PreparedRegionView2<'a>

Source§

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

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

impl<'a> PartialEq for PreparedRegionView2<'a>

Source§

fn eq(&self, other: &PreparedRegionView2<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for PreparedRegionView2<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.