Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Latest commit

 

History

History
 
 

clip

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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)

Acknowledgements

This library is based on mapbox/lineclip.