Re: [Groff] Drawing filled circle segments

2005-10-30 Thread Ted Harding
On 30-Oct-05 Amber Hassaan wrote: > Hi Werner, >Having read solutions posted to the > forgoing problem by Ted and others,I think the task is > solved for now.But I would rather that(in coming > releases of groff): > 1.pic had some construct like filled arc and filled > polygon.(in addit

Re: [Groff] Drawing filled circle segments

2005-10-30 Thread Amber Hassaan
Hi Werner, Having read solutions posted to the forgoing problem by Ted and others,I think the task is solved for now.But I would rather that(in coming releases of groff): 1.pic had some construct like filled arc and filled polygon.(in addition to \D request) 2.\D'***' request could be en

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Ted Harding
On 28-Oct-05 Tadziu Hoffmann wrote: > > Lots of fun with pie charts. Just for the heck of it, here's a > modified version of Ted's pie-chart mechanism that "remembers" > the angles of the wedges and allows you to give the wedge size > as a percentage of the whole "pie" (plus, it allows you to use

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Tadziu Hoffmann
This one works without string arguments: .sp 3c .de YY ps: def /wedge { gsave currentpoint translate 1 -1 scale newpath 0 0 moveto 0 0 5 2 roll 3.6 mul exch 3.6 mul dup 3 1 roll add arc closepath gsave fill grestore 0 setgray stroke grestore } def .. \Y[YY]\c .de wedge \m[\\$2]\Z'\N'32''

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Tadziu Hoffmann
Lots of fun with pie charts. Just for the heck of it, here's a modified version of Ted's pie-chart mechanism that "remembers" the angles of the wedges and allows you to give the wedge size as a percentage of the whole "pie" (plus, it allows you to use "groff" colors; the \N'32' (which should be a

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Ted Harding
On 28-Oct-05 Werner LEMBERG wrote: > >> Well, here's a skeleton with an example of use. > > *Very* nice! > >> Basically, as it is, you invoke in-line it with >> >> \*[wedge radius(pts) Red Green Blue Angle1 Angle2] > > Aah, you use the new string syntax with arguments! This means that > you n

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Werner LEMBERG
> Well, here's a skeleton with an example of use. *Very* nice! > Basically, as it is, you invoke in-line it with > > \*[wedge radius(pts) Red Green Blue Angle1 Angle2] Aah, you use the new string syntax with arguments! This means that you need at least groff 1.18. Thanks a lot for your solut

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Ted Harding
Here is a variant where the sectors are outlined with thin black lines, if you prefer that. \X'ps: def \ /drawwedge { \ newpath \ 0 0 moveto \ 0 0 rad ang1 ang2 arc \ closepath \ } def' \X'ps: def \ /wedge { gsave \ currentpoint translate 1 -1 scale \ /ang2 exch def \ /ang1 exch

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Ted Harding
Another Oops! The end of the \X'ps: def' was missing its closing quote in my first post (not that it seemed to spoil it!). Here is the code again. \X'ps: def \ /wedge { gsave \ currentpoint translate 1 -1 scale \ /ang2 exch def \ /ang1 exch def \ /B exch def /G exch def /R exch def \ /r

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Ted Harding
[OOPS] On 28-Oct-05 Ted Harding wrote: > [...] > .LP > \& > .sp 1i > This is a line with_\h'0.5i'\ > \*[wedge 36 1.0 0.0 0.0 000 045]\ > \*[wedge 36 0.5 0.5 0.0 045 100]\ > \*[wedge 36 0.0 1.0 0.0 100 170]\ > \*[wedge 36 0.0 0.5 0.5 170 250]\ > \*[wedge 36 0.0 0.0 1.0 250 360]\ > \h'0.5i'_in the mi

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Ted Harding
On 28-Oct-05 Werner LEMBERG wrote: > >> I need to use drawing requests (\D'...') directly (without >> using PIC) to make pie-chart segments that can be filled with >> color. > > This isn't possible directly in groff (nor it is possible directly > with pic). It is not too difficult to write a mac

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Werner LEMBERG
> It works well for what I need right now, but the macro approach > makes sense provided groff supports sine, cosine, and tangent > functions... Given that groff doesn't have a `float' data type only ad-hoc solutions for the trigonometric functions, suitable to a specific problem, make sense IMHO.

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Clarke Echols
I solved my problem for now by changing my approach to the pie chart and using solid color for the circle, then I filled one small segment by drawing short, straight lines a few points wide before drawing over the entire thing with an outer dark circle and the various radii. It works well for what

Re: [Groff] Drawing filled circle segments

2005-10-28 Thread Werner LEMBERG
> I need to use drawing requests (\D'...') directly (without > using PIC) to make pie-chart segments that can be filled with > color. This isn't possible directly in groff (nor it is possible directly with pic). It is not too difficult to write a macro which constructs the segment itself with \D

RE: [Groff] Drawing filled circle segments

2005-10-25 Thread Ted Harding
On 25-Oct-05 Clarke Echols wrote: > > I need to use drawing requests (\D'...') directly (without > using PIC) to make pie-chart segments that can be filled with > color. > > I have no problem getting filled boxes and polygons, but I > have not discovered how to draw two lines with an included > a