geom/polygonf.go

15 lines
365 B
Go
Raw Normal View History

package geom
// PolygonF is defined by a set of points (floating point).
type PolygonF struct {
Points []PointF
}
// Add creates a new polyqon based on p with one or more extra points q.
func (p PolygonF) Add(q ...PointF) PolygonF {
var t = PolygonF{make([]PointF, len(p.Points)+len(q))}
copy(t.Points, p.Points)
copy(t.Points[len(p.Points):], q)
return t
}