Circular Lingo

A thread on DIRECT-L came up wondering about a handler that could draw a vector shape circle of a specific size. This little knock-off script is just reverse-engineered from a circle drawn with the vector shape tools.

on createVectorCircle diameter
  vs = new (#vectorshape)
  radius = diameter / 2.0
  rhsqh = radius * sqrt (0.5)
  cpoffset = rhsqh * 0.5625
  vs.vertexlist = [[#vertex: point(-rhsqh, -rhsqh), \
                    #handle1: point(cpoffset, -cpoffset), \
                    #handle2: point(-cpoffset, cpoffset)], \
                   [#vertex: point(rhsqh, -rhsqh), \
                    #handle1: point(cpoffset, cpoffset), \
                    #handle2: point(-cpoffset, -cpoffset)], \
                   [#vertex: point(rhsqh, rhsqh), \
                    #handle1: point(-cpoffset, cpoffset), \
                    #handle2: point(cpoffset, -cpoffset)], \
                   [#vertex: point(-rhsqh, rhsqh), \
                    #handle1: point(-cpoffset, -cpoffset), \
                    #handle2: point(cpoffset, cpoffset)]]
  vs.closed = true
end