Lisp HUG Maillist Archive

draw-arc

I'm trying to use GP:DRAW-ARC to render pie charts.  I must be  
misunderstanding something because I'm not getting the output I was  
expecting.  This code

(let ((x (contain (make-instance 'output-pane))))
     (gp:draw-arc x 0 0 130 130 0 (* 0.5 PI) :filled t))

generates the attached screenshot.  I was expecting to see a filled- 
in quarter of a circle.  Am I misunderstanding what draw-arc is for?

Bill





Re: draw-arc

I think that most draw-arc behaves the way you expect. Try

(let ((x (capi:contain (make-instance 'capi:output-pane))))
              (gp:draw-arc x 0 0 130 130 0 (* 1.5 PI) :filled nil))

for instance. I imagine that what you'r'e expecting. It looks like what
is happening is that the *filling* isn't what you'd expect. for instance

(let ((x (capi:contain (make-instance 'capi:output-pane))))
              (gp:draw-arc x 0 0 100 100 0 (* 1.5 PI) :filled t)
              (gp:draw-arc x 100 100 100 100 0 (* 1.5 PI) :filled nil))

gives the results in the image i've attached. It seems like the arc is being
drawn as a polygon and so the filled region is that inside the polygon
when the two endpoints of the drawn arc are joined. I would have thought
(and I'm guessing this is what you expected) that there might be an extra
vertex at the center of the (implicit) ellipse.

On 10/23/06, Bill Atkins <atkinw@rpi.edu> wrote:
> I'm trying to use GP:DRAW-ARC to render pie charts.  I must be
> misunderstanding something because I'm not getting the output I was
> expecting.  This code
>
> (let ((x (contain (make-instance 'output-pane))))
>      (gp:draw-arc x 0 0 130 130 0 (* 0.5 PI) :filled t))
>
> generates the attached screenshot.  I was expecting to see a filled-
> in quarter of a circle.  Am I misunderstanding what draw-arc is for?
>
> Bill
>
>
>
>
>
>
>


-- 
=====================
Joshua Taylor
tayloj@rpi.edu

Updated at: 2020-12-10 08:47 UTC