I was reading groff_diff(7)'s short and simple description of the GNU
troff drawing command extension, `\D'P'`.

     \D'P h1 v1 ... hn vn'
                   As \D'p', but the polygon is filled.

Instantly (or not, given that I must have read this sentence dozens of
times before without finding it noteworthy), a problem occurred to me.

How does the formatter know which parts to fill?

I have a vague conception that finding determining whether a point is
interior to a polygon is something of an open question.  Call it a rumor
one hears among mathematics undergraduates in the break room.  This, I
gather, is why applied topologists go on about "convex hulls".  (I don't
have a _proper_ understanding of these things.)

If the question seems easy, it's probably because you're thinking of
conventional convex polygons, and maybe even regular ones, with all
sides the same length.

But those are especially well-behaved specimens of polygon.

Haughtily, I figured I could break GNU troff at once.

$ cat EXPERIMENTS/concave-filled-polygon.groff
.sp
Try to make a filled bowtie.
.sp
Let's see what happens.
.sp
\D'P 0 1i 1i -1i 0 1i'

...but it worked!

Clearly the formatter can figure out simple cases like this.

But, if I'm right about polygon concavity being a killer, ultimately one
can get the formatter to go wrong, either by misrendering, failing an
assertion, or going computationally asymptotic as it struggles with
interiority like a character from a Bergman film.

If someone would test GNU troff's boundaries so that I can document what
those boundaries are, I'd appreciate it.

Same if you can disabuse me of my misguided mathematical notions.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to