def ellipse(x, y, a, b, resolution, fillDensity=False):
 poly = toolpath.Polygon()
 if (not resolution):
  resolution = self.circleResolution
 if fillDensity:
  if (a > b):
   largerDimension = a
  else:
   largerDimension = b
  numFills = int((float(fillDensity) * float(largerDimension)))
 else:
  numFills = 1
 (startAngle, endAngle) = (0, 360)
 circumference = ((float(2) * math.pi) * float((float((a + b)) / 2)))
 angleDiv = (float(360) / float((circumference * resolution)))
 (lastX, lastY) = _calcEllipse(startAngle, a, b)
 if (startAngle > endAngle):
  endAngle += 360
 for d in range(1, (numFills + 1)):
  ra = ((float(d) / float(numFills)) * float(a))
  rb = ((float(d) / float(numFills)) * float(b))
  for theta in _frange(startAngle, (endAngle + angleDiv), angleDiv):
   (newX, newY) = _calcEllipse(theta, ra, rb)
   aLine = poly.addPoint(toolpath.Point((newX + x), (newY + y)))
   if debug:
    print 'aLine', aLine
 return poly

def ellipse ( x , y , a , b , resolution , fillDensity = False ) : poly = toolpath . Polygon ( ) if ( not resolution ) : resolution = self . circleResolution if fillDensity : if ( a > b ) : largerDimension = a else : largerDimension = b numFills = int ( ( float ( fillDensity ) * float ( largerDimension ) ) ) else : numFills = 1 ( startAngle , endAngle ) = ( 0 , 360 ) circumference = ( ( float ( 2 ) * math . pi ) * float ( ( float ( ( a + b ) ) / 2 ) ) ) angleDiv = ( float ( 360 ) / float ( ( circumference * resolution ) ) ) ( lastX , lastY ) = _calcEllipse ( startAngle , a , b ) if ( startAngle > endAngle ) : endAngle += 360 for d in range ( 1 , ( numFills + 1 ) ) : ra = ( ( float ( d ) / float ( numFills ) ) * float ( a ) ) rb = ( ( float ( d ) / float ( numFills ) ) * float ( b ) ) for theta in _frange ( startAngle , ( endAngle + angleDiv ) , angleDiv ) : ( newX , newY ) = _calcEllipse ( theta , ra , rb ) aLine = poly . addPoint ( toolpath . Point ( ( newX + x ) , ( newY + y ) ) ) if debug : print 'aLine' , aLine return poly
generates a flat .