vibespatial.predicates.polygon¶
Attributes¶
Classes¶
Typed device-capable certificate for one convex polygonal row. |
|
Typed family-row certificate for simple positive-area source rings. |
Functions¶
Return a cached exact-sign convex/no-hole certificate. |
|
Certify every physical source row for the convex vertex theorem. |
|
Classify all family coordinates, then reduce by source geometry. |
|
|
Evaluate one device-counted DE-9IM span into shared tile output. |
|
Evaluate a spatial predicate from DE-9IM bitmasks. |
|
Evaluate a spatial predicate from device-resident DE-9IM bitmasks. |
Evaluate rectangle-bounds |
|
Evaluate |
|
Evaluate polygonal |
|
|
Evaluate polygonal |
|
Compute DE-9IM bitmasks for geometry candidate pairs on GPU. |
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¶
- class vibespatial.predicates.polygon.NativeConvexMaskCertificate¶
Typed device-capable certificate for one convex polygonal row.
- source_token: str¶
- owner_id: int¶
- device_state_id: int¶
- row_mapping_id: int¶
- family_row: int¶
- coordinate_count: int¶
- values: Any¶
- convex_simple: bool¶
- residency: vibespatial.runtime.residency.Residency¶
- readiness: vibespatial.api._native_state.NativeStreamReadiness¶
- validate(owner: vibespatial.geometry.owned.OwnedGeometryArray, state: Any, buffer: Any, *, family: vibespatial.geometry.buffers.GeometryFamily, family_row: int) None¶
- class vibespatial.predicates.polygon.NativeSimplePolygonalSourceCertificate¶
Typed family-row certificate for simple positive-area source rings.
- source_token: str¶
- owner_id: int¶
- device_state_id: int¶
- row_mapping_id: int¶
- family_row_count: int¶
- coordinate_count: int¶
- values: Any¶
- all_certified: bool¶
- residency: vibespatial.runtime.residency.Residency¶
- readiness: vibespatial.api._native_state.NativeStreamReadiness¶
- validate(owner: vibespatial.geometry.owned.OwnedGeometryArray, state: Any, buffer: Any, *, family: vibespatial.geometry.buffers.GeometryFamily) None¶
- vibespatial.predicates.polygon.certify_single_polygonal_convex_no_holes_gpu(mask_owned: vibespatial.geometry.owned.OwnedGeometryArray, *, mask_family: vibespatial.geometry.buffers.GeometryFamily, family_row: int = 0) NativeConvexMaskCertificate¶
Return a cached exact-sign convex/no-hole certificate.
The one-byte device result is an explicit planning packet. It crosses the boundary once per immutable OwnedGeometryArray generation and is then reused by every public predicate consumer of that mask.
- vibespatial.predicates.polygon.certify_polygonal_sources_simple_no_holes_gpu(source_owned: vibespatial.geometry.owned.OwnedGeometryArray, *, source_family: vibespatial.geometry.buffers.GeometryFamily) NativeSimplePolygonalSourceCertificate¶
Certify every physical source row for the convex vertex theorem.
The sufficient source domain is deliberately narrow: one simple, non-empty, positive-area ring (and one part for MultiPolygon). Anything else declines the complete-batch fast path and retains the general exact predicate. This makes invalid geometries fail closed without making a vertex-only claim about arbitrary OGC topology.
- vibespatial.predicates.polygon.compute_polygonal_covered_by_single_convex_grouped_gpu(query_owned: vibespatial.geometry.owned.OwnedGeometryArray, mask_owned: vibespatial.geometry.owned.OwnedGeometryArray, *, query_family: vibespatial.geometry.buffers.GeometryFamily, mask_family: vibespatial.geometry.buffers.GeometryFamily)¶
Classify all family coordinates, then reduce by source geometry.
This is the measured direct/broadcast convex-containment shape. It emits no candidate relation and constructs no point geometry or dense group-code vector. The authoritative family coordinate offsets are consumed directly by the bounded segmented
ALLreducer.
- vibespatial.predicates.polygon.evaluate_de9im_grouped_device(d_masks, predicate: str, *, source_offset, logical_count, launch_capacity: int, out)¶
Evaluate one device-counted DE-9IM span into shared tile output.
- 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.evaluate_predicate_from_de9im_device(d_masks: object, predicate: str) object¶
Evaluate a spatial predicate from device-resident DE-9IM bitmasks.
- vibespatial.predicates.polygon.compute_rect_bounds_polygon_mask_predicates_gpu(mask_owned: vibespatial.geometry.owned.OwnedGeometryArray, rect_bounds: object, *, mask_family: vibespatial.geometry.buffers.GeometryFamily, return_device: bool = False) tuple[object, object] | tuple[numpy.ndarray, numpy.ndarray] | None¶
Evaluate rectangle-bounds
intersectsandcovered_bypredicates.Physical shape: a device rowset of axis-aligned rectangle bounds against one polygon mask row. The source rectangles do not need to be materialized as polygon geometry for this predicate refine; the constructive stage can still consume the original source rows for exact output assembly.
- 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, d_pair_count: object | None = None, pair_capacity: int | None = None, return_device: bool = False) numpy.ndarray | None¶
Evaluate
query covered_by maskfor 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_polygonal_covered_by_pair_rows_no_holes_gpu(query_owned: vibespatial.geometry.owned.OwnedGeometryArray, mask_owned: vibespatial.geometry.owned.OwnedGeometryArray, *, query_family: vibespatial.geometry.buffers.GeometryFamily, mask_family: vibespatial.geometry.buffers.GeometryFamily, d_left: object, d_right: object, d_pair_count: object | None = None, pair_capacity: int | None = None, return_device: bool = False) numpy.ndarray | None¶
Evaluate polygonal
query covered_by maskrelation pairs on device.This preserves the relation-pair physical shape for callers that already hold device row arrays. Convex no-hole masks use the cheaper one-sided proof; concave, multipart, and hole-bearing masks remain exact by falling through inside the kernel to the polygon DE-9IM predicate path.
- vibespatial.predicates.polygon.compute_polygonal_intersects_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, d_pair_count: object | None = None, pair_capacity: int | None = None, d_pair_offset: object | None = None, launch_capacity: int | None = None, d_out: object | None = None, return_device: bool = False) numpy.ndarray | None¶
Evaluate polygonal
intersectsas a boolean relation-pair refine.This is narrower than a full DE-9IM matrix. It returns the boolean predicate directly and lets the kernel early-exit on boundary contact or containment, preserving device relation pairs for downstream consumers.
- 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, d_pair_count: object | None = None, pair_capacity: int | None = None, d_pair_offset: object | None = None, launch_capacity: int | None = None, d_mask: 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
Nonewhen d_left / d_right are provided —pair_countis derived fromd_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).
- d_pair_countcupy.ndarray or None
Optional device scalar naming how many leading entries in d_left / d_right are live. This preserves candidate-refine rowsets whose count is produced by a device compaction kernel without a host scalar sizing fence.
- pair_capacityint or None
Launch capacity for d_left / d_right when d_pair_count is used.
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.