Documentation
¶
Index ¶
- type Contour
- type Polygon
- func (p *Polygon) Add(c Contour)
- func (p Polygon) Bounds() geom.Rect
- func (p Polygon) ClipLine(other Polygon) Polygon
- func (p Polygon) Clone() Polygon
- func (p Polygon) Contains(pt geom.Point) bool
- func (p Polygon) ContainsEvenOdd(pt geom.Point) bool
- func (p Polygon) Intersect(other Polygon) Polygon
- func (p Polygon) Simplify() Polygon
- func (p Polygon) Subtract(other Polygon) Polygon
- func (p Polygon) Union(other Polygon) Polygon
- func (p Polygon) Xor(other Polygon) Polygon
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contour ¶
Contour is a sequence of vertices connected by line segments, forming a closed shape.
type Polygon ¶
type Polygon []Contour
Polygon holds one or more contour lines. The polygon may contain holes and may be self-intersecting. Note that the methods Union, Intersect, Subtract, Xor, and ClipLine all require that the polygons not have have self-intersections. Use of the Simplify() method will ensure a polygon can be used with those methods.
func (Polygon) ClipLine ¶
ClipLine returns the result of removing the other polygon from this polygon. Assumes this polygon is actually a line.
Note: This function is not designed to handle self-intersecting polygons. Remove self-intersections first using the Simplify function.
func (Polygon) ContainsEvenOdd ¶
ContainsEvenOdd returns true if the point is contained by the polygon using the even-odd rule. https://en.wikipedia.org/wiki/Even-odd_rule
func (Polygon) Intersect ¶
Intersect returns the intersection of both polygons.
Note: This function is not designed to handle self-intersecting polygons. Remove self-intersections first using the Simplify function.
func (Polygon) Simplify ¶
Simplify returns a polygon with all self-intersections and repeated edges removed.
func (Polygon) Subtract ¶
Subtract returns the result of removing the other polygon from this polygon.
Note: This function is not designed to handle self-intersecting polygons. Remove self-intersections first using the Simplify function.