21 lines
552 B
Go
21 lines
552 B
Go
|
package geom
|
||
|
|
||
|
// PointsF32 is a set of points.
|
||
|
type PointsF32 []PointF32
|
||
|
|
||
|
// PolF32 creates a polygon of points q.
|
||
|
func PolF32(q ...PointF32) PolygonF32 { return PolygonF32{Points: q} }
|
||
|
|
||
|
// PolygonF32 is defined by a set of points (floating point).
|
||
|
type PolygonF32 struct {
|
||
|
Points PointsF32
|
||
|
}
|
||
|
|
||
|
// Add creates a new polyqon based on p with one or more extra points q.
|
||
|
func (p PolygonF32) Add(q ...PointF32) PolygonF32 {
|
||
|
var t = PolygonF32{make(PointsF32, len(p.Points)+len(q))}
|
||
|
copy(t.Points, p.Points)
|
||
|
copy(t.Points[len(p.Points):], q)
|
||
|
return t
|
||
|
}
|