Sander Schobers
26bac636bc
- Includes PointF, RectangleF and PolygonF. Additional it includes the 32 bit floating point PointF32 and wrappers to image.Point and image.Rectangle.
15 lines
365 B
Go
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
|
|
}
|