+ (let* ((x-ext (ly:stencil-extent stencil X))
+ (y-ext (ly:stencil-extent stencil Y))
+ (diameter (max (interval-length x-ext)
+ (interval-length y-ext)))
+ (radius (+ (/ diameter 2) padding thickness))
+ (circle (make-circle-stencil radius thickness #f)))
+
+ (ly:stencil-add
+ stencil
+ (ly:stencil-translate circle
+ (cons
+ (interval-center x-ext)
+ (interval-center y-ext))))))
+
+(define-public (oval-stencil stencil thickness x-padding y-padding)
+ "Add an oval around @code{stencil}, padded by the padding pair,
+ producing a new stencil."
+ (let* ((x-ext (ly:stencil-extent stencil X))
+ (y-ext (ly:stencil-extent stencil Y))
+ (x-length (+ (interval-length x-ext) x-padding thickness))
+ (y-length (+ (interval-length y-ext) y-padding thickness))
+ (x-radius (* 0.707 x-length) )
+ (y-radius (* 0.707 y-length) )
+ (oval (make-oval-stencil x-radius y-radius thickness #f)))
+
+ (ly:stencil-add
+ stencil
+ (ly:stencil-translate oval
+ (cons
+ (interval-center x-ext)
+ (interval-center y-ext))))))
+
+(define-public (ellipse-stencil stencil thickness x-padding y-padding)
+ "Add an ellipse around STENCIL, padded by the padding pair,
+ producing a new stencil."
+ (let* ((x-ext (ly:stencil-extent stencil X))
+ (y-ext (ly:stencil-extent stencil Y))
+ (x-length (+ (interval-length x-ext) x-padding thickness))
+ (y-length (+ (interval-length y-ext) y-padding thickness))
+ ;(aspect-ratio (/ x-length y-length))
+ (x-radius (* 0.707 x-length) )
+ (y-radius (* 0.707 y-length) )
+ ;(diameter (max (- (cdr x-ext) (car x-ext))
+ ; (- (cdr y-ext) (car y-ext))))
+ ;(radius (+ (/ diameter 2) padding thickness))
+ (ellipse (make-ellipse-stencil x-radius y-radius thickness #f)))
+