Circle
public defstruct Circle <: Shape :
center: Point
radius: Double with: (ensure => non-negative!)
public defn Circle (x:Double, y:Double, radius:Double) :
Circle(Point(x,y), radius)
public defn Circle (anchor:Anchor, x:Double, y:Double, radius:Double) :
val [vt, hr] = components(anchor)
val x* = match(hr) :
(hr:W) : x + radius
(hr:C) : x
(hr:E) : x - radius
val y* = match(vt) :
(vt:S) : y + radius
(vt:C) : y
(vt:N) : y - radius
Circle(Point(x*,y*), radius)
public defn Circle (anchor:Anchor, radius:Double) :
Circle(anchor, 0.0, 0.0, radius)
public defn Circle (radius:Double) :
Circle(C, 0.0, 0.0, radius)
Circle(Point(1.0, 3.0), 1.5)
Circle(1.0, 3.0, 1.5)
Circle(C, 1.0, 3.0, 1.5)
Circle(C, 5.0)
Circle(5.0)