Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #3422
| Newsgroups | comp.lang.postscript |
|---|---|
| Date | 2019-07-20 09:33 -0700 |
| References | (9 earlier) <f33ac85c-3814-49a2-82a5-ee72a8fdd8ff@googlegroups.com> <e01e8168-970d-4c58-a965-6eefb6707534@googlegroups.com> <2be8c81c-3188-407d-a191-3db485e19800@googlegroups.com> <560e57c2-4be3-4c06-853b-3dbd34928190@googlegroups.com> <95be98d9-f2f3-436d-b274-d675c840a771@googlegroups.com> |
| Message-ID | <a349987a-f07a-4337-ba3e-d99a67f3d365@googlegroups.com> (permalink) |
| Subject | Re: Fierce and scary geometry algorithm for ‘ParallelPath’ |
| From | luser droog <luser.droog@gmail.com> |
On Friday, July 19, 2019 at 4:00:23 PM UTC-5, luser droog wrote:
>
> I rewrote everything from scratch since the other code was long and
> complicated and also wrong. This version makes ears on the sharp turns,
> but it should be easier for me to figure something out now that it's
> all shorter and simpler.
>
I want to point out 2 "hacks" in the code that I'm trying to generalize.
First, the glyph path as expected does not consist entirely of closed paths,
but ends with a single 'moveto' to position the next glyph. When I grab the
path data and try to wrap it in a depth=2 array, I have to add an extra ']'
to close my array. And this leaves a length=2 subpath in my data structure
which should not undergo the offsetting procedure.
> /closedsubpaths { [ { [ 3 1 roll } { } { } { ] } pathforall ] ] } def
I think this behavior can be generalized to be more robust for arbitrary
path data by replacing that final ']' with
{{]}stopped{exit}if}loop
Secondly, the outer curve of the '9' has the last point coincident with
the first. Being closed already takes care of patching up these two points.
But have both identical points present in the list of points makes a zero
vector when I calculate vectors. (Correction: I think both the inner and
outer curves have this coincident point.)
Currently I'm handling this by just explicitly discarding the last point
in the curve. But a more robust solution would find all the zero vectors
and remove corresponding points anywhere in the path.
But this idea is turning out to be damned tricky to implement. I can get
an array of booleans that correspond to the zero vectors easily enough.
But making a loop to run through the booleans and snip corresponding
indices in the path means that every time I do a snip, subsequent indices
have been shifted. So I can't just use a simple 'for' loop. ...
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar
Fierce and scary geometry algorithm for ‘ParallelPath’ jdawiseman.bloomberg@gmail.com - 2019-04-17 13:37 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ edspikechapman@gmail.com - 2019-04-19 08:55 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ jdawiseman.bloomberg@gmail.com - 2019-04-20 02:44 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ Carlos <carlos@cvkm.cz> - 2019-04-29 02:41 +0200
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ jdaw1 <jdawiseman@gmail.com> - 2019-06-19 15:04 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-22 13:33 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-22 14:54 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-22 15:37 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-23 15:59 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-27 06:59 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-27 07:48 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-27 08:30 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-06-28 12:10 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-07-19 14:00 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-07-20 09:33 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-07-20 13:20 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ jdaw1 <jdawiseman@gmail.com> - 2021-03-14 10:25 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ jdawiseman.bloomberg@gmail.com - 2019-04-20 06:54 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-04-20 10:44 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ jdawiseman.bloomberg@gmail.com - 2019-04-20 11:01 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-04-20 11:33 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-04-20 11:50 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-04-20 13:01 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ jdawiseman.bloomberg@gmail.com - 2019-04-21 03:29 -0700
Re: Fierce and scary geometry algorithm for ‘ParallelPath’ luser droog <luser.droog@gmail.com> - 2019-04-28 13:33 -0700
csiph-web