vibespatial.predicates.polygon

Attributes

Functions

evaluate_predicate_from_de9im(→ numpy.ndarray)

Evaluate a spatial predicate from DE-9IM bitmasks.

compute_polygonal_covered_by_single_mask_no_holes_gpu(...)

Evaluate query covered_by mask for one polygonal mask on device.

compute_polygon_de9im_gpu(→ numpy.ndarray | None)

Compute DE-9IM bitmasks for geometry candidate pairs on GPU.

supported_predicate_families(...)

Return the set of family pairs supported by polygon predicate kernels.

Module Contents

vibespatial.predicates.polygon.DE9IM_II = 1
vibespatial.predicates.polygon.DE9IM_IB = 2
vibespatial.predicates.polygon.DE9IM_IE = 4
vibespatial.predicates.polygon.DE9IM_BI = 8
vibespatial.predicates.polygon.DE9IM_BB = 16
vibespatial.predicates.polygon.DE9IM_BE = 32
vibespatial.predicates.polygon.DE9IM_EI = 64
vibespatial.predicates.polygon.DE9IM_EB = 128
vibespatial.predicates.polygon.DE9IM_EE = 256
vibespatial.predicates.polygon.evaluate_predicate_from_de9im(masks: numpy.ndarray, predicate: str) numpy.ndarray

Evaluate a spatial predicate from DE-9IM bitmasks.

Parameters

masks : uint16 array of DE-9IM bitmasks predicate : one of the supported predicate names

Returns

bool array

vibespatial.predicates.polygon.compute_polygonal_covered_by_single_mask_no_holes_gpu(query_owned: vibespatial.geometry.owned.OwnedGeometryArray, mask_owned: vibespatial.geometry.owned.OwnedGeometryArray, left_indices: numpy.ndarray | None = None, *, query_family: vibespatial.geometry.buffers.GeometryFamily, mask_family: vibespatial.geometry.buffers.GeometryFamily, d_left: object | None = None, return_device: bool = False) numpy.ndarray | None

Evaluate query covered_by mask for one polygonal mask on device.

Convex no-hole masks use a cheaper one-sided proof in the kernel. Concave, multipart, and hole-bearing masks fall through to the exact polygon DE-9IM device path instead of a host-side capability branch.

vibespatial.predicates.polygon.compute_polygon_de9im_gpu(query_owned: vibespatial.geometry.owned.OwnedGeometryArray, tree_owned: vibespatial.geometry.owned.OwnedGeometryArray, left_indices: numpy.ndarray | None = None, right_indices: numpy.ndarray | None = None, *, query_family: vibespatial.geometry.buffers.GeometryFamily, tree_family: vibespatial.geometry.buffers.GeometryFamily, d_left: object | None = None, d_right: object | None = None, return_device: bool = False) numpy.ndarray | None

Compute DE-9IM bitmasks for geometry candidate pairs on GPU.

Supports all combinations of LINESTRING, MULTILINESTRING, POLYGON, and MULTIPOLYGON families.

When d_left / d_right are provided (device-resident CuPy int32 arrays), they are used directly instead of uploading left_indices / right_indices from host — avoiding a redundant host->device transfer when candidates are already on device.

Parameters

left_indices, right_indicesnp.ndarray or None

Host index arrays. May be None when d_left / d_right are provided — pair_count is derived from d_left.shape[0].

return_devicebool

When True, return the result as a device-resident CuPy uint16 array (caller takes ownership). The D->H copy is skipped entirely. Default False preserves backward compatibility (returns host np.ndarray).

Returns

np.ndarray | cupy.ndarray | None

uint16 DE-9IM bitmask array, or None if the family pair is not supported.

vibespatial.predicates.polygon.supported_predicate_families() frozenset[tuple[vibespatial.geometry.buffers.GeometryFamily, vibespatial.geometry.buffers.GeometryFamily]]

Return the set of family pairs supported by polygon predicate kernels.