Commit 7bdec5a
peng.li24
feat: add pycpp pybind11 wrapper layer for geometry types
Add pycpp/ directory providing thin pybind11 wrappers for shapelycpp
native C++ geometry types, following the numpypy/pycpp pattern.
pycpp/geometry_py.h:
- Factory functions: point(f64/f32), linestring(f64/f32), polygon(f64/f32),
linearring — accept Python list of coords
- Cross-type distance: distance_pt_ls, distance_pt_poly, distance_ls_poly,
distance_poly_ls
- Cross-type intersects: intersects_ls_poly, intersects_poly_poly
- All 9 predicate pair combinations (pt↔pt, pt↔ls, pt↔poly, ls↔pt, etc.)
- Centroid, project, interpolate, intersection_area, polygon_exterior
- BIND_PREDS / BIND_ACCESSORS macros for consistent class binding
pycpp/ops_py.h:
- nearest_points_poly_ls, nearest_points_ls_pt
tests/module.cpp:
- Refactored from 400→223 lines: uses pycpp wrappers instead of
hand-written free functions and macros
- Serves as reference example for consuming projects
README: updated project structure to document pycpp/ directory1 parent 994b618 commit 7bdec5a
4 files changed
Lines changed: 513 additions & 322 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
141 | 144 | | |
142 | | - | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
| |||
0 commit comments