vibespatial.spatial.segment_primitives

Classes

SegmentIntersectionKind

Enum where members are also (and must be) ints

SegmentTable

DeviceSegmentTable

GPU-resident segment table in SoA layout.

SegmentIntersectionResult

Segment intersection results with lazy host materialization.

SegmentIntersectionBenchmark

SegmentIntersectionDeviceState

SegmentIntersectionCandidates

DeviceSegmentIntersectionCandidates

GPU-resident candidate pairs from sweep-based spatial join.

Functions

extract_segments(→ SegmentTable)

Extract segments from geometry array on CPU (legacy path).

generate_segment_candidates(...)

classify_segment_intersections(→ SegmentIntersectionResult)

Classify all segment-segment intersections between two geometry arrays.

benchmark_segment_intersections(...)

Module Contents

class vibespatial.spatial.segment_primitives.SegmentIntersectionKind

Enum where members are also (and must be) ints

DISJOINT = 0
PROPER = 1
TOUCH = 2
OVERLAP = 3
class vibespatial.spatial.segment_primitives.SegmentTable
row_indices: numpy.ndarray
part_indices: numpy.ndarray
ring_indices: numpy.ndarray
segment_indices: numpy.ndarray
x0: numpy.ndarray
y0: numpy.ndarray
x1: numpy.ndarray
y1: numpy.ndarray
bounds: numpy.ndarray
property count: int
class vibespatial.spatial.segment_primitives.DeviceSegmentTable

GPU-resident segment table in SoA layout.

row_indices: vibespatial.cuda._runtime.DeviceArray
segment_indices: vibespatial.cuda._runtime.DeviceArray
x0: vibespatial.cuda._runtime.DeviceArray
y0: vibespatial.cuda._runtime.DeviceArray
x1: vibespatial.cuda._runtime.DeviceArray
y1: vibespatial.cuda._runtime.DeviceArray
count: int
class vibespatial.spatial.segment_primitives.SegmentIntersectionResult

Segment intersection results with lazy host materialization.

When produced by the GPU pipeline, all 14 result arrays live in device_state and host numpy arrays are lazily copied on first property access. GPU-only consumers (e.g. build_gpu_split_events) that read only device_state, candidate_pairs, count, runtime_selection, precision_plan, and robustness_plan never trigger device-to-host copies.

candidate_pairs: int
runtime_selection: vibespatial.runtime.RuntimeSelection
precision_plan: vibespatial.runtime.precision.PrecisionPlan
robustness_plan: vibespatial.runtime.robustness.RobustnessPlan
device_state: SegmentIntersectionDeviceState | None = None
property left_rows: numpy.ndarray
property left_segments: numpy.ndarray
property left_lookup: numpy.ndarray
property right_rows: numpy.ndarray
property right_segments: numpy.ndarray
property right_lookup: numpy.ndarray
property kinds: numpy.ndarray
property point_x: numpy.ndarray
property point_y: numpy.ndarray
property overlap_x0: numpy.ndarray
property overlap_y0: numpy.ndarray
property overlap_x1: numpy.ndarray
property overlap_y1: numpy.ndarray
property ambiguous_rows: numpy.ndarray
property count: int
kind_names() list[str]
class vibespatial.spatial.segment_primitives.SegmentIntersectionBenchmark
rows_left: int
rows_right: int
candidate_pairs: int
disjoint_pairs: int
proper_pairs: int
touch_pairs: int
overlap_pairs: int
ambiguous_pairs: int
elapsed_seconds: float
class vibespatial.spatial.segment_primitives.SegmentIntersectionDeviceState
left_rows: vibespatial.cuda._runtime.DeviceArray
left_segments: vibespatial.cuda._runtime.DeviceArray
left_lookup: vibespatial.cuda._runtime.DeviceArray
right_rows: vibespatial.cuda._runtime.DeviceArray
right_segments: vibespatial.cuda._runtime.DeviceArray
right_lookup: vibespatial.cuda._runtime.DeviceArray
kinds: vibespatial.cuda._runtime.DeviceArray
point_x: vibespatial.cuda._runtime.DeviceArray
point_y: vibespatial.cuda._runtime.DeviceArray
overlap_x0: vibespatial.cuda._runtime.DeviceArray
overlap_y0: vibespatial.cuda._runtime.DeviceArray
overlap_x1: vibespatial.cuda._runtime.DeviceArray
overlap_y1: vibespatial.cuda._runtime.DeviceArray
ambiguous_rows: vibespatial.cuda._runtime.DeviceArray
class vibespatial.spatial.segment_primitives.SegmentIntersectionCandidates
left_rows: numpy.ndarray
left_segments: numpy.ndarray
left_lookup: numpy.ndarray
right_rows: numpy.ndarray
right_segments: numpy.ndarray
right_lookup: numpy.ndarray
pairs_examined: int
tile_size: int
property count: int
class vibespatial.spatial.segment_primitives.DeviceSegmentIntersectionCandidates

GPU-resident candidate pairs from sweep-based spatial join.

left_rows: vibespatial.cuda._runtime.DeviceArray
left_segments: vibespatial.cuda._runtime.DeviceArray
left_lookup: vibespatial.cuda._runtime.DeviceArray
right_rows: vibespatial.cuda._runtime.DeviceArray
right_segments: vibespatial.cuda._runtime.DeviceArray
right_lookup: vibespatial.cuda._runtime.DeviceArray
count: int
vibespatial.spatial.segment_primitives.extract_segments(geometry_array: vibespatial.geometry.owned.OwnedGeometryArray) SegmentTable

Extract segments from geometry array on CPU (legacy path).

vibespatial.spatial.segment_primitives.generate_segment_candidates(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray, *, tile_size: int = 512) SegmentIntersectionCandidates
vibespatial.spatial.segment_primitives.classify_segment_intersections(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray, *, candidate_pairs: SegmentIntersectionCandidates | None = None, tile_size: int = 512, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) SegmentIntersectionResult

Classify all segment-segment intersections between two geometry arrays.

Parameters

left, rightOwnedGeometryArray

Input geometry arrays (linestring, polygon, or multi-variants).

candidate_pairsSegmentIntersectionCandidates, optional

Pre-computed candidate pairs. If None, candidates are generated internally (GPU-native O(n log n) when GPU mode, tiled CPU otherwise).

tile_sizeint

Tile size for CPU candidate generation (ignored in GPU mode).

dispatch_modeExecutionMode

Force GPU, CPU, or AUTO dispatch.

precisionPrecisionMode

Force fp32, fp64, or AUTO precision.

Returns

SegmentIntersectionResult

Classification of all candidate segment pairs.

vibespatial.spatial.segment_primitives.benchmark_segment_intersections(left: vibespatial.geometry.owned.OwnedGeometryArray, right: vibespatial.geometry.owned.OwnedGeometryArray, *, tile_size: int = 512, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO) SegmentIntersectionBenchmark