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>
impl<'a> PreparedRegionView2<'a>
Sourcepub fn from_region(region: &'a Region2, policy: &CurvePolicy) -> Self
pub fn from_region(region: &'a Region2, policy: &CurvePolicy) -> Self
Builds a prepared view from an owned region.
Sourcepub fn from_region_view(region: &RegionView2<'a>, policy: &CurvePolicy) -> Self
pub fn from_region_view(region: &RegionView2<'a>, policy: &CurvePolicy) -> Self
Builds a prepared view from a borrowed region view.
Sourcepub const fn region_box(&self) -> Option<&Aabb2>
pub const fn region_box(&self) -> Option<&Aabb2>
Returns the cached whole-region box when every contour box was decided.
Sourcepub fn material_contours(&self) -> &[&'a Contour2]
pub fn material_contours(&self) -> &[&'a Contour2]
Returns material contours in the prepared view.
Sourcepub fn hole_contours(&self) -> &[&'a Contour2]
pub fn hole_contours(&self) -> &[&'a Contour2]
Returns hole contours in the prepared view.
Sourcepub fn as_region_view(&self) -> RegionView2<'a>
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.
Sourcepub fn prepared_material_contours(&self) -> &[PreparedContourView2<'a>]
pub fn prepared_material_contours(&self) -> &[PreparedContourView2<'a>]
Returns prepared material contours in region-bin order.
Sourcepub fn prepared_hole_contours(&self) -> &[PreparedContourView2<'a>]
pub fn prepared_hole_contours(&self) -> &[PreparedContourView2<'a>]
Returns prepared hole contours in region-bin order.
Sourcepub const fn facts(&self) -> &RegionFacts
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.
Sourcepub fn classify_point(
&self,
point: &Point2,
policy: &CurvePolicy,
) -> Classification<RegionPointLocation>
pub fn classify_point( &self, point: &Point2, policy: &CurvePolicy, ) -> Classification<RegionPointLocation>
Classifies a point against this prepared region view.
Sourcepub fn signed_depth(
&self,
point: &Point2,
policy: &CurvePolicy,
) -> Classification<i32>
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.
Sourcepub fn intersect_prepared_region(
&self,
other: &PreparedRegionView2<'_>,
policy: &CurvePolicy,
) -> CurveResult<RegionIntersectionSet>
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.
Sourcepub fn intersect_region(
&self,
other: &RegionView2<'_>,
policy: &CurvePolicy,
) -> CurveResult<RegionIntersectionSet>
pub fn intersect_region( &self, other: &RegionView2<'_>, policy: &CurvePolicy, ) -> CurveResult<RegionIntersectionSet>
Collects normalized topology events against an ordinary region view.
Sourcepub fn boolean_boundary_loops(
&self,
other: &PreparedRegionView2<'_>,
op: BooleanOp,
policy: &CurvePolicy,
) -> CurveResult<Classification<BooleanBoundaryLoopSet>>
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.
Sourcepub fn boolean_boundary_loops_against_region(
&self,
other: &RegionView2<'_>,
op: BooleanOp,
policy: &CurvePolicy,
) -> CurveResult<Classification<BooleanBoundaryLoopSet>>
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.
Sourcepub fn boolean_boundary_contours(
&self,
other: &PreparedRegionView2<'_>,
op: BooleanOp,
fill_rule: FillRule,
policy: &CurvePolicy,
) -> CurveResult<Classification<Vec<Contour2>>>
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.
Sourcepub fn boolean_boundary_contours_against_region(
&self,
other: &RegionView2<'_>,
op: BooleanOp,
fill_rule: FillRule,
policy: &CurvePolicy,
) -> CurveResult<Classification<Vec<Contour2>>>
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.
Sourcepub fn boolean_region(
&self,
other: &PreparedRegionView2<'_>,
op: BooleanOp,
fill_rule: FillRule,
policy: &CurvePolicy,
) -> CurveResult<Classification<Region2>>
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.
Sourcepub fn boolean_region_against_region(
&self,
other: &RegionView2<'_>,
op: BooleanOp,
fill_rule: FillRule,
policy: &CurvePolicy,
) -> CurveResult<Classification<Region2>>
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>
impl<'a> Clone for PreparedRegionView2<'a>
Source§fn clone(&self) -> PreparedRegionView2<'a>
fn clone(&self) -> PreparedRegionView2<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for PreparedRegionView2<'a>
impl<'a> Debug for PreparedRegionView2<'a>
Source§impl<'a> PartialEq for PreparedRegionView2<'a>
impl<'a> PartialEq for PreparedRegionView2<'a>
Source§fn eq(&self, other: &PreparedRegionView2<'a>) -> bool
fn eq(&self, other: &PreparedRegionView2<'a>) -> bool
self and other values to be equal, and is used by ==.