MCPcopy Index your code
hub / github.com/gonum/plot / NewPolygon

Function NewPolygon

plotter/polygon.go:37–50  ·  view source on GitHub ↗

NewPolygon returns a polygon that uses the default line style and no fill color, where xys are the rings of the polygon. Different backends may render overlapping rings and self-intersections differently, but all built-in backends treat inner rings with the opposite winding order from the outer ring

(xys ...XYer)

Source from the content-addressed store, hash-verified

35// with the opposite winding order from the outer ring as
36// holes.
37func NewPolygon(xys ...XYer) (*Polygon, error) {
38 data := make([]XYs, len(xys))
39 for i, d := range xys {
40 var err error
41 data[i], err = CopyXYs(d)
42 if err != nil {
43 return nil, err
44 }
45 }
46 return &Polygon{
47 XYs: data,
48 LineStyle: DefaultLineStyle,
49 }, nil
50}
51
52// Plot draws the polygon, implementing the plot.Plotter
53// interface.

Callers 3

TestPolygon_clipFunction · 0.92
ExamplePolygon_holesFunction · 0.92
ExamplePolygon_hexagonsFunction · 0.92

Calls 1

CopyXYsFunction · 0.85

Tested by 3

TestPolygon_clipFunction · 0.74
ExamplePolygon_holesFunction · 0.74
ExamplePolygon_hexagonsFunction · 0.74