Polygon¶
public defstruct Polygon <: Shape :
points: Tuple<Point> with: (ensure => min-length!(3))
with:
constructor => #Polygon
public defn Polygon (pts:Seqable<Point|Seqable>) :
val pts* = to-tuple(flatten-shapes(pts))
ensure-points(pts*, "polygon")
#Polygon(pts* as Tuple<Point>)
Polygon([
Point(2.0, 2.0),
Point(-2.0, 2.0),
Point(-2.0, -2.0),
Point(2.0, -2.0)])