geom/polygonf.go
Sander Schobers 26bac636bc Initial version of the geom package
- Includes PointF, RectangleF and PolygonF. Additional it includes the 32 bit floating point PointF32 and wrappers to image.Point and image.Rectangle.
2017-11-01 06:51:41 +01:00

15 lines
365 B
Go

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
}