groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] [pic] Add support for arbitrary polygons


From: Duncan Losin
Subject: [PATCH] [pic] Add support for arbitrary polygons
Date: Mon, 30 Sep 2024 07:03:05 +0000

Hi folks,

I have written a patch to add support for drawing arbitrary polygons in pic 
using the existing syntax for multi-segment lines. They can be shaded and 
filled as expected of other closed objects. Examples attached in polygon.pdf.

There is also new syntax for referencing the positions of the vertices and edge 
midpoints:

- .v[er[tex]] expr
- .v[er[tex]] `expr'
- .p[oint] expr
- .p[oint] `expr'

I must admit I have a very limited computer science education, so I expect my 
implementation could use some improvements; feedback would be appreciated. I'm 
not entirely pleased with how vertex_number is set, but I struggled with 
polygon_object not being instanced until the end of object_spec::make_line. 
That seems to be the general structure of the program so I didn't want to 
change it, but perhaps there's a better way to set the value, among other 
things.

I've also included the following small documentation update. Where referring to 
ordinals the documentation included the characters " ` " and " ' " i.e. the 
grave accent and apostrophe. These are the correct characters, but groff draws 
these as the left and right quotation marks,
which confused me when I tried to use this feature. I've updated those 
characters to the appropriate escape sequences "\[ga]" and "\[aq]" so that they 
appear properly.

Future Work:
If I understand it correctly (big if), PostScript interprets all polygons as a 
path, much like how pic draws multi-line segments. PostScript however can 
include arcs and splines as segments and fill the resulting shape. It doesn't 
look like it would be terribly difficult to implement this in pic, but it would 
be a lot of work. I believe pic, groff, and grops would all need to updated to 
accommodate the new drawing command.

This process is all quite new to me so I appreciate your patience. Happy to 
make any changes required.

Thanks,

Duncan

Attachment: polygon.pdf
Description: Adobe PDF document

Attachment: polygon.patch
Description: Text Data

Attachment: polygon.roff
Description: Text Data

Attachment: polygon_ChangeLog
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]