         context.fill()
         return this
 
+    # Set the polygon's vertices. The first vertex will dictate the element's
+    # position.
     setVertices : (vertices, silent=false) ->
         if not vertices? or vertices.length < 3
             throw new Error("minimum three vertices")

#= require math


class wolf.Polygon extends wolf.Element
    
    @key : 'wolf.Polygon'

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

    # Return the point at the geometrical center of the element.
    getCenter : ()  ->
        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 the element counter-clockwise by the given number of degrees.
    rotate : (degrees, silent=false) ->
        return this if not degrees
        c = @getCenter()
