Expand description
Hobby snap rounding for robust geometric operations.
Snap rounding is a technique to achieve robustness in computational geometry by snapping all coordinates (and intersection points) to a regular grid. This eliminates floating-point inconsistencies and ensures topological validity of noded segment arrangements.
§Algorithm
The iterative Hobby snap rounding algorithm proceeds as:
- Snap all input coordinates to the precision grid.
- Collect all pairwise segment-segment intersections (cross-line).
- Snap each intersection to the grid.
- Split every segment that an intersection point lies on.
- Repeat steps 2-4 until convergence or
max_iterationsis reached. - Remove zero-length segments.
§References
- J. Hobby, “Practical segment intersection with finite precision output”, Computational Geometry, 13(4):199-214, 1999.
Structs§
- Snap
Rounding Options - Options controlling snap rounding behaviour.
- Snap
Rounding Result - Result returned by
snap_round. - Snapped
Segment - A single output segment after snap rounding.
Functions§
- snap_
coordinate - Snap a single coordinate to the precision grid.
- snap_
linestring - Snap all coordinates in a slice to the precision grid, removing consecutive duplicates that arise after snapping.
- snap_
round - Perform iterative Hobby snap rounding on a collection of polylines.