 #
-# A class representing an arbitrary convex polygon.
+# Polygons.
 #
 
 

        @trigger('moved', @) if changed and not silent
        this

    getCenter : ()  ->
        # The co-ordinates of the center point are the 
        # averages of the polygon's vertices.
        c = @vertices.reduce((p, v) ->
            return p.add(v)
        , new wolf.Point(0, 0))

        c.x = c.x / @vertices.length
        c.y = c.y / @vertices.length
        return c

    rotate : (degrees, silent=false) ->
        return this if not degrees
        c = @getCenter()

        delta = point.subtract(@getPosition())
        return @setVertices((v.add(delta) for v in @vertices), silent)

    # Render the polygon on the given canvas context.
    render : (context) ->
        [first, rest...] = @vertices
        context.beginPath()
