pub struct Region2 { /* private fields */ }Expand description
An owned planar region with explicit material and hole contour bins.
The bins are signed by role, not by trusting contour orientation. A point’s depth is the number of containing material contours minus the number of containing hole contours. Positive depth is inside; zero or negative depth is outside. This intentionally supports nested islands by putting the inner island contour back in the material bin.
Implementations§
Source§impl Region2
impl Region2
Sourcepub fn project_to_finite_region(
&self,
options: &FiniteProjectionOptions,
) -> CurveResult<FiniteRegionProjection2>
pub fn project_to_finite_region( &self, options: &FiniteProjectionOptions, ) -> CurveResult<FiniteRegionProjection2>
Projects this region to finite material/hole rings for IO and display.
Region roles are preserved, but the returned rings are boundary
products only. Exact point classification and area should continue to
use Region2::classify_point and Region2::filled_area.
Sourcepub fn project_to_finite_profiles(
&self,
options: &FiniteProjectionOptions,
policy: &CurvePolicy,
) -> CurveResult<Classification<Vec<FiniteRegionProfile2>>>
pub fn project_to_finite_profiles( &self, options: &FiniteProjectionOptions, policy: &CurvePolicy, ) -> CurveResult<Classification<Vec<FiniteRegionProfile2>>>
Projects exact material/hole ownership profiles to finite rings.
Ownership is classified before projection with
Region2::contour_profiles, so this method does not recover holes
from sampled centroids or winding heuristics. The returned rings are
still finite API-boundary products; exact topology remains in the
region. This follows Yap’s exact-object/API-boundary split and the
boundary-first point-in-polygon structure surveyed by Hormann and
Agathos, both cited on Region2::contour_profiles.
Source§impl Region2
impl Region2
Sourcepub fn prepare_point_classifier(
&self,
policy: &CurvePolicy,
) -> PreparedRegionView2<'_>
pub fn prepare_point_classifier( &self, policy: &CurvePolicy, ) -> PreparedRegionView2<'_>
Builds a prepared borrowed view for repeated point classification.
Sourcepub fn prepare_topology_queries(
&self,
policy: &CurvePolicy,
) -> PreparedRegionView2<'_>
pub fn prepare_topology_queries( &self, policy: &CurvePolicy, ) -> PreparedRegionView2<'_>
Builds a prepared borrowed view for repeated point and event queries.
Source§impl Region2
impl Region2
Sourcepub const fn new(
material_contours: Vec<Contour2>,
hole_contours: Vec<Contour2>,
) -> Self
pub const fn new( material_contours: Vec<Contour2>, hole_contours: Vec<Contour2>, ) -> Self
Constructs a region from explicit material and hole contour bins.
Sourcepub const fn from_material_contours(material_contours: Vec<Contour2>) -> Self
pub const fn from_material_contours(material_contours: Vec<Contour2>) -> Self
Constructs a region from material contours only.
Sourcepub fn material_contours(&self) -> &[Contour2]
pub fn material_contours(&self) -> &[Contour2]
Returns material contours.
Sourcepub fn hole_contours(&self) -> &[Contour2]
pub fn hole_contours(&self) -> &[Contour2]
Returns hole contours.
Sourcepub fn as_view(&self) -> RegionView2<'_>
pub fn as_view(&self) -> RegionView2<'_>
Returns a borrowed view over this region.
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 region.
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 non-boundary points.
Sourcepub fn filled_area(
&self,
policy: &CurvePolicy,
) -> CurveResult<Classification<Option<Real>>>
pub fn filled_area( &self, policy: &CurvePolicy, ) -> CurveResult<Classification<Option<Real>>>
Returns the exact filled area implied by the region’s material/hole roles.
Unlike Contour2::signed_area, this ignores contour orientation:
material bins add the absolute contour area and hole bins subtract it.
This keeps the region role model explicit and avoids treating winding as
hidden topology state. The area is accumulated from exact
Green’s-theorem contour facts and branches only after the sign of each
contour contribution is certified, following Yap, “Towards Exact
Geometric Computation,” Computational Geometry 7(1-2), 1997
(https://doi.org/10.1016/0925-7721(95)00040-2).
Returns Decided(None) when a contour contains a segment whose exact
area contribution is not implemented by the current object model.
Sourcepub fn contour_profiles(
&self,
policy: &CurvePolicy,
) -> Classification<Vec<RegionContourProfile<'_>>>
pub fn contour_profiles( &self, policy: &CurvePolicy, ) -> Classification<Vec<RegionContourProfile<'_>>>
Groups material contours with the hole contours they contain.
Ownership is decided with exact contour point classification before any finite export projection exists. This follows the boundary-first point-in-polygon structure surveyed by Hormann and Agathos, “The Point in Polygon Problem for Arbitrary Polygons,” Computational Geometry 20(3), 2001 (https://doi.org/10.1016/S0925-7721(01)00012-8), and the exact-object/API-boundary split advocated by Yap, “Towards Exact Geometric Computation,” Computational Geometry 7(1-2), 1997 (https://doi.org/10.1016/0925-7721(95)00040-2).
Sourcepub fn intersect_region(
&self,
other: &Self,
policy: &CurvePolicy,
) -> CurveResult<RegionIntersectionSet>
pub fn intersect_region( &self, other: &Self, policy: &CurvePolicy, ) -> CurveResult<RegionIntersectionSet>
Collects normalized topology events against another region.
Source§impl Region2
impl Region2
Sourcepub fn boolean_boundary_loops(
&self,
other: &Self,
op: BooleanOp,
policy: &CurvePolicy,
) -> CurveResult<Classification<BooleanBoundaryLoopSet>>
pub fn boolean_boundary_loops( &self, other: &Self, op: BooleanOp, policy: &CurvePolicy, ) -> CurveResult<Classification<BooleanBoundaryLoopSet>>
Computes closed boolean boundary loops against another owned region.
This is a convenience wrapper over RegionView2::boolean_boundary_loops.
Sourcepub fn boolean_boundary_contours(
&self,
other: &Self,
op: BooleanOp,
fill_rule: FillRule,
policy: &CurvePolicy,
) -> CurveResult<Classification<Vec<Contour2>>>
pub fn boolean_boundary_contours( &self, other: &Self, op: BooleanOp, fill_rule: FillRule, policy: &CurvePolicy, ) -> CurveResult<Classification<Vec<Contour2>>>
Computes checked boolean boundary contours against another owned region.
The returned contours are closed result boundaries. They are not yet assigned to material or hole bins; that role assignment belongs to the later nesting pass.
Sourcepub fn boolean_region(
&self,
other: &Self,
op: BooleanOp,
fill_rule: FillRule,
policy: &CurvePolicy,
) -> CurveResult<Classification<Self>>
pub fn boolean_region( &self, other: &Self, op: BooleanOp, fill_rule: FillRule, policy: &CurvePolicy, ) -> CurveResult<Classification<Self>>
Computes a role-assigned boolean region against another owned region.
The result is available only when the current boundary pipeline can produce closed contours and the nesting pass can classify those contours without boundary ambiguity.
Source§impl Region2
impl Region2
Sourcepub fn from_boundary_contours(
contours: Vec<Contour2>,
policy: &CurvePolicy,
) -> CurveResult<Classification<Self>>
pub fn from_boundary_contours( contours: Vec<Contour2>, policy: &CurvePolicy, ) -> CurveResult<Classification<Self>>
Builds a region by nesting closed boundary contours into material/hole bins.
Contours at even containment depth become material. Contours at odd depth become holes. This matches the even-odd nesting interpretation commonly used after boolean traversal has produced disjoint closed output loops.
Source§impl Region2
impl Region2
Sourcepub fn transform_similarity(&self, transform: &Similarity2) -> CurveResult<Self>
pub fn transform_similarity(&self, transform: &Similarity2) -> CurveResult<Self>
Applies a certified planar similarity transform to every material and hole contour.