vibespatial.kernels.constructive.polygon_rect_intersection

GPU-native element-wise polygon-vs-rectangle intersection kernel.

Clips each polygon row in left against an axis-aligned rectangle row in right. The rectangle comes from the right polygon’s exact 5-vertex box coordinates, keeping the work on the GPU and avoiding the generic overlay pipeline for parcel-grid workloads.

ADR-0033: Tier 1 (custom NVRTC kernel) – geometry-specific ring traversal and

rectangle clipping.

ADR-0002: CONSTRUCTIVE class – stays fp64 on all devices per policy. ADR-0034: NVRTC precompilation via request_nvrtc_warmup at module scope.

Attributes

Functions

device_trusted_single_ring_polygon_batch(→ bool)

Return True when device metadata proves logical rows fit this kernel.

device_trusted_rectangle_bounds_matrix(owned)

Return row-aligned device bounds when metadata proves rectangle rows.

device_single_ring_polygon_mask(owned, *[, ...])

Return a device mask for logical rows that are simple single-ring polygons.

device_polygon_shape_mask_bounds(owned, *[, ...])

Return simple mask, rectangle mask, and polygon bounds as one rowset carrier.

device_rectangle_polygon_mask_and_bounds(owned)

Return (device_mask, device_bounds) for logical rectangle polygon rows.

polygon_rect_boundary_contacts_from_bounds(...)

Build point and line rectangle/polygon boundary intersections on device.

rectangle_rectangle_boundary_intersections_from_bounds(...)

Build exact lower-dimensional rectangle intersections at row capacity.

polygon_rect_intersection_from_bounds(...)

Clip logical polygon rows by row-aligned device rectangle bounds.

polygon_rect_split_boundary_component_replacements(...)

Return replacement rows for repeated-boundary rectangle clip rings.

polygon_rect_split_boundary_component_replacements_from_bounds(...)

Return row-capacity boundary-split replacements from rectangle bounds.

polygon_rect_split_boundary_components(...)

Split repeated-boundary rectangle clip rings into row-aligned output.

polygon_rect_intersection_can_handle(→ bool)

rectangle_intersection_can_handle(→ bool)

Return True when both resident operands are proven rectangle batches.

rectangle_intersection(...)

Compute row-aligned rectangle intersections with fixed-width output.

polygon_rect_intersection(...)

Module Contents

vibespatial.kernels.constructive.polygon_rect_intersection.cp = None
vibespatial.kernels.constructive.polygon_rect_intersection.logger
vibespatial.kernels.constructive.polygon_rect_intersection.device_trusted_single_ring_polygon_batch(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, max_input_vertices: int = _MAX_INPUT_VERTS) bool

Return True when device metadata proves logical rows fit this kernel.

vibespatial.kernels.constructive.polygon_rect_intersection.device_trusted_rectangle_bounds_matrix(owned: vibespatial.geometry.owned.OwnedGeometryArray)

Return row-aligned device bounds when metadata proves rectangle rows.

vibespatial.kernels.constructive.polygon_rect_intersection.device_single_ring_polygon_mask(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, max_input_vertices: int = _MAX_INPUT_VERTS)

Return a device mask for logical rows that are simple single-ring polygons.

vibespatial.kernels.constructive.polygon_rect_intersection.device_polygon_shape_mask_bounds(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, max_input_vertices: int = _MAX_INPUT_VERTS)

Return simple mask, rectangle mask, and polygon bounds as one rowset carrier.

vibespatial.kernels.constructive.polygon_rect_intersection.device_rectangle_polygon_mask_and_bounds(owned: vibespatial.geometry.owned.OwnedGeometryArray)

Return (device_mask, device_bounds) for logical rectangle polygon rows.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_boundary_contacts_from_bounds(mask: vibespatial.geometry.owned.OwnedGeometryArray, rect_bounds, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.GPU) tuple[vibespatial.geometry.owned.OwnedGeometryArray, object, vibespatial.geometry.owned.OwnedGeometryArray, object, object] | None

Build point and line rectangle/polygon boundary intersections on device.

Physical shape: a device rowset of rectangle bounds against one single-ring polygon mask. Point and collinear-line contacts are emitted as separate row-aligned capacities so callers can compose both without geometry-object reconstruction. The admitted carrier is one physically singular ring with at most _BOUNDARY_CONTACT_MAX_SEGMENTS segments; line components are ordered and merged at segment capacity instead of using a fixed part queue.

vibespatial.kernels.constructive.polygon_rect_intersection.rectangle_rectangle_boundary_intersections_from_bounds(left_bounds, right_bounds, *, active_mask=None, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.GPU) vibespatial.geometry.owned.OwnedGeometryArray | None

Build exact lower-dimensional rectangle intersections at row capacity.

Positive-area overlap belongs to the polygon area carrier. This carrier emits only zero-width edge contacts and zero-width/zero-height corner contacts, with null rows for area overlap and disjoint pairs.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_intersection_from_bounds(left: vibespatial.geometry.owned.OwnedGeometryArray, rect_bounds, *, source_rows=None, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.GPU) vibespatial.geometry.owned.OwnedGeometryArray

Clip logical polygon rows by row-aligned device rectangle bounds.

This is the row-indirected carrier for mixed/few-right overlay batches: the subject polygons can remain indexed or repeated, while rectangle geometry is represented by a device (rows, 4) bounds table.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_split_boundary_component_replacements(clipped: vibespatial.geometry.owned.OwnedGeometryArray, rectangles: vibespatial.geometry.owned.OwnedGeometryArray | None = None, *, rect_bounds=None, eligible_mask=None) tuple[vibespatial.geometry.owned.OwnedGeometryArray, object] | None

Return replacement rows for repeated-boundary rectangle clip rings.

polygon_rect_intersection emits one polygon ring per row. Concave mask clips can produce disconnected intersections; in that case the single ring contains repeated rectangle-boundary connector segments. This helper removes those connector edges and closes each component along the rectangle boundary.

The output retains clipped row capacity and carries a device split mask. Callers select the replacement capacity through row indirection, so dynamic split cardinality and nested component counts remain device-resident.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_split_boundary_component_replacements_from_bounds(clipped: vibespatial.geometry.owned.OwnedGeometryArray, rect_bounds, eligible_mask) tuple[vibespatial.geometry.owned.OwnedGeometryArray, object] | None

Return row-capacity boundary-split replacements from rectangle bounds.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_split_boundary_components(clipped: vibespatial.geometry.owned.OwnedGeometryArray, rectangles: vibespatial.geometry.owned.OwnedGeometryArray) vibespatial.geometry.owned.OwnedGeometryArray | None

Split repeated-boundary rectangle clip rings into row-aligned output.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_intersection_can_handle(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray) bool
vibespatial.kernels.constructive.polygon_rect_intersection.rectangle_intersection_can_handle(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray) bool

Return True when both resident operands are proven rectangle batches.

vibespatial.kernels.constructive.polygon_rect_intersection.rectangle_intersection(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode = ExecutionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

Compute row-aligned rectangle intersections with fixed-width output.

vibespatial.kernels.constructive.polygon_rect_intersection.polygon_rect_intersection(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray