sec_interp.core.utils.geometry_utils.processing module
Geometry processing utilities (pure math).
- sec_interp.core.utils.geometry_utils.processing.MAX_DENSIFY_POINTS = 50000
Hard cap on generated vertices to prevent pathological densification. # no-i18n
A tiny
intervalrelative to the polyline extent (a common symptom of mixing a DEM pixel size expressed in a different CRS than the section line) would otherwise allocate millions of vertices and freeze the application.
- sec_interp.core.utils.geometry_utils.processing.densify_line_points(points: list[tuple[float, float]], interval: float) list[tuple[float, float]]
Densify a polyline by inserting intermediate vertices.
Ensures no segment is longer than
interval. Returns the input unchanged if it has fewer than two points or the interval is non-positive. The number of inserted vertices is capped atMAX_DENSIFY_POINTS; the interval is grown if needed to honour the cap.- Parameters:
points – List of (x, y) tuples.
interval – Maximum segment length (in the same units as the points).
- Returns:
Densified list of (x, y) tuples.
- sec_interp.core.utils.geometry_utils.processing.interpolate_segment_points(dist_start: float, dist_end: float, master_grid_dists: list[tuple[float, Any, float]], master_profile_data: list[tuple[float, float]], tolerance: float) list[tuple[float, float]]
Convert boundary distances into a list of points with sampled elevations.
Includes the start/end points and any intermediate grid points from the master profile that fall within the specified distance range.
- Parameters:
dist_start – Start distance along section.
dist_end – End distance along section.
master_grid_dists – Full grid of coordinates and elevations.
master_profile_data – Topography profile (dist, elevation).
tolerance – Distance tolerance for grid inclusions.
- Returns:
List of (distance, elevation) tuples defining the segment profile.