Skip to content

Commit

Permalink
Update library tester. Add guidelines for arcs, add a rectangle and a…
Browse files Browse the repository at this point in the history
… rounded rectangle.
  • Loading branch information
anachrocomputer committed Aug 22, 2020
1 parent 5ceb406 commit a7fa84c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
11 changes: 10 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Things To Do

## HPGL library
* Add support for non-ISO paper sizes (i.e. U.S. paper sizes, origami square paper)
* Add support for non-ISO paper sizes (i.e. U.S. paper sizes,
origami square paper, postcard sizes, photographic sizes).
* Add support for plot scaling. We should be able to plot directly
in millimetres (and possibly in inches) as well as in device
coordinates and maybe in other units.
Expand Down Expand Up @@ -30,6 +31,11 @@ lines in reverse directions.
* Remove 'openlinesequence()', 'linesegmentto()' and 'closelinesequence()'
from the library. They were a bit of a kludge anyway, and inconvenient
for the user.
* Optimise HPGL by not emitting 'PU;PA' in response to a 'moveto()'
if the pen is already at that location. Will probably reduce the number
of zero line segments that we get in 'hp2xx'.
* Change 'rectangle()' to call 'moveto()'/'lineto()'. Let those
functions handle optimisation.
* Draw circles using Arc Absolute 'AA;' and choose arc starting-point
that's closest to current pen position.
* Add support for the front-panel LCD on the HP 7550A. Use the 'WD'
Expand All @@ -45,6 +51,9 @@ arc tolerance of 72 chords. Make this a settable parameter somehow.
comma-separated list of pens. Plot programs could then call for the
next (or previous) pen and make simple multi-colour plots.
Plots that might benefit from that: dala2, morphpoly, sutpent.
* Can we tell 'hp2xx' about pen width via the HPGL? If we can, we'd
be able to get previews with bold or fine pens.
* Should we set pen speeds separately for each pen?
* Eliminate 'hpglout()' if at all possible. It breaks the abstraction
that the library tries to maintain.
* Support non-HPGL output. Maybe PostScript, BMC plotter commands,
Expand Down
23 changes: 20 additions & 3 deletions libtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,22 @@ int main(int argc, char * const argv[])
void lineTest(const double xc, const double yc, const double wd, const double ht, const PlotInfo_t *const info)
{
const double len = wd / 16.0;
double hside = wd * 0.8;
double vside = ht * 0.8;

moveto(xc - len, yc);
lineto(xc + len, yc);

moveto(xc, yc - len);
lineto(xc, yc + len);

rectangle(xc - hside, yc - vside, xc + hside, yc + vside);

hside = wd * 0.7;
vside = ht * 0.7;

roundrect(xc - hside, yc - vside, xc + hside, yc + vside, wd / 8);

hlabel(xc - (wd / 2.0), yc - (ht / 2.0), 5.0, info->plotterName);
hlabel(xc + (wd / 2.0), yc - (ht / 2.0), 5.0, info->paperName);
}
Expand All @@ -116,10 +125,18 @@ void arcTest(const double xc, const double yc, const double wd, const double ht,
double angle;
int i;

moveto(xc - (wd / 2.0), yc);
lineto(xc, yc);
lineto(xc, yc + (wd / 2.0));
moveto(xc - radius, yc);
lineto(xc + radius, yc);

moveto(xc + radius, yc - radius);
lineto(xc - radius, yc + radius);

moveto(xc, yc + radius);
lineto(xc, yc - radius);

moveto(xc - radius, yc - radius);
lineto(xc + radius, yc + radius);

for (i = 0; i < 7; i++) {
radius = (wd / 16.0) * (i + 1);
angle = 45.0 * (i + 1);
Expand Down

0 comments on commit a7fa84c

Please sign in to comment.