vibespatial.constructive.representative_point

GPU-accelerated representative_point using layered centroid + PIP strategy.

Architecture (ADR-0033 tier classification): - Points: identity (Tier 2 CuPy element-wise copy) - LineStrings: midpoint interpolation (Tier 1 NVRTC) - Polygons/MultiPolygons: centroid (existing GPU kernel) + PIP containment

check. For concave polygons where centroid falls outside, a GPU horizontal- ray-intersection kernel finds an interior point without any D2H transfer or Shapely fallback.

Precision (ADR-0002): Centroid computation uses METRIC class dispatch (fp32+Kahan on consumer GPU, fp64 on datacenter). PIP check and horizontal ray intersection use fp64 for exact topology.

Functions

representative_point_owned(...)

Compute a representative point for each geometry in the owned array.

Module Contents

vibespatial.constructive.representative_point.representative_point_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

Compute a representative point for each geometry in the owned array.

Returns a point-only OwnedGeometryArray where each point is guaranteed to lie inside (or on the boundary of) the corresponding input geometry.

Strategy: 1. Points -> identity (the point itself) 2. LineStrings/MultiLineStrings -> midpoint of coordinate extent 3. Polygons/MultiPolygons -> GPU centroid + PIP check. When centroid

is outside (concave polygons), a GPU horizontal-ray-intersection kernel finds an interior point on-device without any Shapely fallback or D2H transfer.

When the GPU path is active, the output OGA is device-resident — no D2H transfer occurs for the coordinate data.