ellipse2_at (PDF::Writer::Graphics)

         # File lib/pdf/writer/graphics.rb, line 256
    256:   def ellipse2_at(x, y, r1, r2 = r1, start = 0, stop = 359.99, segments = 8)
    257:     segments = 2 if segments < 2
    258:
    259:     start = PDF::Math.deg2rad(start)
    260:     stop  = PDF::Math.deg2rad(stop)
    261:
    262:     arc     = stop - start
    263:     segarc  = arc / segments.to_f
    264:     dtm     = segarc / 3.0
    265:
    266:     theta = start
    267:     a0 = x + r1 * Math.cos(theta)
    268:     b0 = y + r2 * Math.sin(theta)
    269:     c0 = -r1 * Math.sin(theta)
    270:     d0 = r2 * Math.cos(theta)
    271:
    272:     move_to(a0, b0)
    273:
    274:     (1..segments).each do |ii|
    275:       theta = ii * segarc + start
    276:
    277:       a1 = x + r1 * Math.cos(theta)
    278:       b1 = y + r2 * Math.sin(theta)
    279:       c1 = -r1 * Math.sin(theta)
    280:       d1 = r2 * Math.cos(theta)
    281:
    282:       curve_to(a0 + (c0 * dtm),
    283:                b0 + (d0 * dtm),
    284:                a1 - (c1 * dtm),
    285:                b1 - (d1 * dtm), a1, b1)
    286:
    287:       a0 = a1
    288:       b0 = b1
    289:       c0 = c1
    290:       d0 = d1
    291:     end
    292:
    293:     move_to(x, y)
    294:     self
    295:   end