vibespatial.constructive.binary_constructive

GPU-accelerated binary constructive operations.

Operations: intersection(a,b), union(a,b), difference(a,b), symmetric_difference(a,b)

Element-wise binary constructive operations dispatched per family pair: - Point-Point: coordinate comparison (Tier 2 CuPy) - Point-Polygon: PIP kernel for intersection/difference - Point-LineString: point-on-segment kernel (Tier 1 NVRTC) - MultiPoint-Polygon: batch PIP + compact - LineString-Polygon: segment clipping kernel (Tier 1 NVRTC) - LineString-LineString: segment-segment intersection kernel (Tier 1 NVRTC) - Polygon-Polygon: overlay pipeline (face selection)

All GPU paths return device-resident OwnedGeometryArray. The function _binary_constructive_gpu never returns None: every family pair is handled by a GPU kernel.

ADR-0033: Tier 3 — complex multi-stage pipeline orchestrating Tier 1/2 kernels. ADR-0002: CONSTRUCTIVE class — stays fp64 on all devices per policy.

Attributes

Functions

is_constructive_op(→ bool)

Check if an operation name is a binary constructive operation.

binary_constructive_owned(...)

Element-wise binary constructive operation on owned arrays.

Module Contents

vibespatial.constructive.binary_constructive.logger
vibespatial.constructive.binary_constructive.is_constructive_op(op: str) bool

Check if an operation name is a binary constructive operation.

vibespatial.constructive.binary_constructive.binary_constructive_owned(op: str, left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray, *, grid_size: float | None = None, dispatch_mode: vibespatial.runtime._runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

Element-wise binary constructive operation on owned arrays.

Uses the standard dispatch framework: plan_dispatch_selection for GPU/CPU routing, select_precision_plan for precision, and record_dispatch_event for observability.

GPU paths: - Polygon-Polygon pairs: overlay pipeline (face selection). - Point-Polygon intersection/difference: PIP kernel + validity masking.

Parameters

opstr

One of ‘intersection’, ‘union’, ‘difference’, ‘symmetric_difference’.

left, rightOwnedGeometryArray

Input geometry arrays (must have same row count).

grid_sizefloat or None

Snap grid size for GEOS precision model. When set, forces the CPU/Shapely path because the GPU pipeline does not support snapped precision.

dispatch_modeExecutionMode or str, default AUTO

Execution mode hint.

precisionPrecisionMode or str, default AUTO

Precision mode for GPU path.