anchor.diff:                 (* a (sin theta) (cos eta))
                  (* b (cos theta) (sin eta))))))
   
  -(defun ell* (lam
  -             center-x center-y
  -             radius1-dx radius1-dy radius2-dx radius2-dy)
  +(defun ellipse-point* (lambda0
  +                       center-x center-y
  +                       radius1-dx radius1-dy radius2-dx radius2-dy)
  +  "Given an ellipse having center CENTER-X, CENTER-Y, and two radii,
  +one described by RADIUS1-DX and RADIUS1-DY, and the other described by
  +RADIUS2-DX and RADIUS2-DY, returns two values, the x and y coordinates
  +of a point on the ellipse having angle LAMBDA0 (CCW) relative to the
  +positive direction of the line parallel to the x-axis that runs
  +through the center of the ellipse. Note that this parameterization of
  +LAMBDA0 is different from that used in ELLIPSE-POINT, which is relative
  +to the major axis."
     (multiple-value-bind (a b theta)
         (reparameterize-ellipse radius1-dx
                                 radius1-dy
                                 radius2-dx
                                 radius2-dy)
  -    (ell (- lam theta) center-x center-y a b theta)))
  -
  -(defun ell-prime (eta a b theta)
  +    (ellipse-point (- lambda0 theta) center-x center-y a b theta)))
  +
  +(defun ellipse-derivative (eta a b theta)
  +  "Given an ellipse having two radii of length A and B, with angle
  +THETA between the radii from the center of the ellipse, returns two
  +values, the x and y coordinates of the derivative of the parametric
  +curve of ellipse at the parametric angle eta. Note that this eta is
  +not the angle ANGLE, as in ellipse-derivative*, but rather is computed
  +parametricly from theta. See the paper from Luc Maisonobe for
  +details."
     (values (+ (- (* a (cos theta) (sin eta)))
                (- (* b (sin theta) (cos eta))))
             (+ (- (* a (sin theta) (sin eta)))
                (* b (cos theta) (cos eta)))))
   
  -(defun ell-prime* (lam1 lam2
  -                   center-x center-y
  -                   radius1-dx radius1-dy radius2-dx radius2-dy)
  +(defun cubic-bezier-control-points (lambda1 lambda2
  +                                    center-x center-y
  +                                    radius1-dx radius1-dy radius2-dx radius2-dy)
  +  "Given an ellipse having center CENTER-X, CENTER-Y, and two radii,
  +one described by RADIUS1-DX and RADIUS1-DY, and the other described by
  +RADIUS2-DX and RADIUS2-DY, returns four values corresponding to x1,
  +y1, and x2, y2, of the two control points of a cubic bezier curve
  +approximation of the elliptical arc from angle lambda1 to lambda2."
     (declare (ignore center-x center-y))
     (multiple-value-bind (a b theta)
         (reparameterize-ellipse radius1-dx radius1-dy radius2-dx radius2-dy)
  -    (let ((lam1 (- lam1 theta))
  -          (lam2 (- lam2 theta)))
  -      (let ((eta1 (atan (/ (sin lam1) b)
  -                        (/ (cos lam1) a)))
  -            (eta2 (atan (/ (sin lam2) b)
  -                        (/ (cos lam2) a))))
  +    (let ((lambda1 (- lambda1 theta))
  +          (lambda2 (- lambda2 theta)))
  +      (let ((eta1 (atan (/ (sin lambda1) b)
  +                        (/ (cos lambda1) a)))
  +            (eta2 (atan (/ (sin lambda2) b)
  +                        (/ (cos lambda2) a))))
           (let ((alpha (* (sin (- eta2 eta1))
                           (/ (- (sqrt (+ 4 (* 3 (square (tan (/ (- eta2 eta1) 2)))))) 1)
                              3))))
             (multiple-value-bind (e1x e1y)
  -              (ell-prime eta1 a b theta)
  +              (ellipse-derivative eta1 a b theta)
               (multiple-value-bind (e2x e2y)
  -                (ell-prime eta2 a b theta)
  +                (ellipse-derivative eta2 a b theta)
                 (values (* alpha e1x)
                         (* alpha e1y)
                         (* alpha e2x)
                         (* alpha e2y)))))))))
   
  -(defun normalize-angle (angle)
  -  (if (or (< angle 0)
  -          (> angle (* pi 2)))
  -      (mod angle (* pi 2))
  -      angle))
  -
  -(defun find-angle* (x1 y1 x2 y2)
  -  (let ((theta (- (phase (complex y2 x2))
  -                  (phase (complex y1 x1)))))
  -    (normalize-angle theta)))
  -
   (defun transformation-angle (tr)
  +  "Returns the angle (in radians) described by the given
  +transformation."
  +  ;; We can't just use the parameters of the transformation for this,
  +  ;; so we take two orthogonal vectors, transform them with tr and
  +  ;; compute the angle between the two transformed vectors.
     (let ((x1 0) (y1 1)
           (x2 1) (y2 0))
       (multiple-value-bind (tx1 ty1)
  
positive.code:         (+ (find-angle* tx1 ty1 tx2 ty2) )))))
  
  (defun transform-angle (tr angle)
    (+ angle (transformation-angle tr) ))
  
  (defun put-ellipse (center-x center-y
                      radius1-dx radius1-dy radius2-dx radius2-dy
                      start-angle end-angle tr filled)
    (let ((first-segment t))
      (flet ((bez (p1x p1y q1x q1y q2x q2y p2x p2y)
               (with-transformed-position (tr p1x p1y)
  
negative.code:                (find-angle radius1-dx radius1-dy))))
        (values a b theta))))
  
  (defun ellipse-point (lambda0 center-x center-y a b theta)
    "Given an ellipse having center CENTER-X, CENTER-Y, and two radii of
  length A and B, with angle THETA between the radii from the center of
  the ellipse, returns two values, the x and y coordinates of a point on
  the ellipse having angle LAMBDA0 (CCW) relative to the major axis of the
  ellipse."
    (let ((eta (atan (/ (sin lambda0) b)
                     (/ (cos lambda0) a))))
      (values (+ center-x
                 (* a (cos theta) (cos eta))
                 (- (* b (sin theta) (sin eta))))
  