vibespatial.constructive.properties

GPU-accelerated geometry property computations.

All operations are pure offset arithmetic — no coordinate reads needed (except is_closed and is_ccw which read coordinates).

Operations: - num_coordinates: geometry_offsets[row+1] - geometry_offsets[row]

(for polygon/multipolygon, uses ring_offsets indirection)

  • num_geometries: always 1 for simple types, part count for multi types

  • num_interior_rings: ring_count - 1 per polygon

  • x/y accessors: read coordinate at geometry_offsets[row] for Point family

  • is_closed: compare first/last coordinates per span (NVRTC Tier 1)

  • is_ccw: shoelace signed area on exterior ring (NVRTC Tier 1)

ADR-0033: - num_coordinates, num_geometries, num_interior_rings: Tier 1 (NVRTC offset_diff)

for simple/multi families; Tier 1 (NVRTC nested-loop) for polygon families

  • is_closed, is_ccw: Tier 1 (NVRTC)

Attributes

cp

Functions

num_coordinates_owned(→ numpy.ndarray)

Compute per-geometry coordinate count from offset arrays.

num_geometries_owned(→ numpy.ndarray)

Compute per-geometry part count from offset arrays.

num_interior_rings_owned(→ numpy.ndarray)

Compute per-geometry interior ring count.

get_x_owned(→ numpy.ndarray)

Extract x coordinates for Point geometries from coordinate buffers.

get_y_owned(→ numpy.ndarray)

Extract y coordinates for Point geometries from coordinate buffers.

is_closed_owned(→ numpy.ndarray)

Check if geometries are closed (first coord == last coord).

is_ccw_owned(→ numpy.ndarray)

Check if polygon exterior rings are counter-clockwise.

Module Contents

vibespatial.constructive.properties.cp = None
vibespatial.constructive.properties.num_coordinates_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Compute per-geometry coordinate count from offset arrays.

Avoids Shapely materialization by reading offset buffers directly. Device-native path uses NVRTC offset_diff kernel for simple families and nested-loop NVRTC kernels for families with offset indirection (Polygon, MultiLineString, MultiPolygon).

vibespatial.constructive.properties.num_geometries_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Compute per-geometry part count from offset arrays.

Simple types return 1, multi types return part count. Device-native path uses NVRTC offset_diff kernel (Tier 1).

vibespatial.constructive.properties.num_interior_rings_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Compute per-geometry interior ring count.

Only meaningful for Polygon family (ring_count - 1). Device-native path uses NVRTC offset_diff_interior_rings kernel (Tier 1).

vibespatial.constructive.properties.get_x_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Extract x coordinates for Point geometries from coordinate buffers.

When device_state is populated with Point family, reads directly from device buffers via CuPy without calling _ensure_host_state().

vibespatial.constructive.properties.get_y_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Extract y coordinates for Point geometries from coordinate buffers.

When device_state is populated with Point family, reads directly from device buffers via CuPy without calling _ensure_host_state().

vibespatial.constructive.properties.is_closed_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Check if geometries are closed (first coord == last coord).

For LineString: compare first and last coordinate. For MultiLineString: all parts must be closed. For Polygon/MultiPolygon/Point/MultiPoint: always True.

Device-native path uses NVRTC kernels for LineString and MultiLineString families. Other families are handled as constants.

vibespatial.constructive.properties.is_ccw_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray) numpy.ndarray

Check if polygon exterior rings are counter-clockwise.

Uses shoelace signed area: positive = CCW. Only meaningful for Polygon and MultiPolygon families. Other types return False.

Device-native path uses NVRTC kernel for shoelace computation.