Skip to content

Files

Latest commit

b23f468 · Feb 23, 2022

History

History

clip

orb/clip Godoc Reference

Package orb/clip provides functions for clipping lines and polygons to a bounding box.

Example

bound := orb.Bound{Min: orb.Point{0, 0}, Max: orb.Point{30, 30}}

ls := orb.LineString{
    {-10, 10}, {10, 10}, {10, -10}, {20, -10}, {20, 10},
    {40, 10}, {40, 20}, {20, 20}, {20, 40}, {10, 40},
    {10, 20}, {5, 20}, {-10, 20},
}

// works on and returns an orb.Geometry interface.
clipped = clip.Geometry(bound, ls)

// or clip the line string directly
clipped = clip.LineString(bound, ls)

List of sub-package utilities

Acknowledgements

This library is based on mapbox/lineclip.