Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Insideness testing of paths not points

24 views
Skip to first unread message

jdaw1

unread,
Nov 8, 2006, 2:46:46 PM11/8/06
to
How can one test whether filling a path would render anything? In the
code there is a clipping region and there is a current path: how can
one test whether any part of the currentpath is inside clippath?
AFAICT, PostScript seems to provide insideness testing for points, not
paths.

Chapman Flack

unread,
Nov 8, 2006, 8:16:31 PM11/8/06
to
jdaw1 wrote:
> How can

> one test whether any part of the currentpath is inside clippath?
> AFAICT, PostScript seems to provide insideness testing for points, not
> paths.

gsave false upath clippath infill grestore ?

won't work if the path includes any protected character
outline though. Might want a strokepath before upath
depending on how the path is to be used.

-Chap

jdaw1

unread,
Nov 10, 2006, 9:15:47 PM11/10/06
to
Should that be
gsave newpath clippath false upath grestore infill ?
(So that the aperture parameter passed to infill is the derived from
the current clippath?)

Chapman Flack

unread,
Nov 11, 2006, 9:20:43 AM11/11/06
to

Well, my approach was to use the original path as
aperture and determine whether any of it would be
painted by filling the clippath. Yours is using the
clippath as aperture to see if any of it would be
painted by filling the original path. Since what we're
really after is whether there is a nonempty intersection
of the two regions, I'm thinking the choice of approach
is arbitrary.

-Chap

jdaw1

unread,
Nov 11, 2006, 11:01:22 PM11/11/06
to
1. Sorry, I misunderstood your code.

2. In general a clippath can be a complicated nested set of things,
whereas the currentpath is known to be one character's path,
strokepath'ed. That asymmetry raises the possibility that one method
would be more efficient, though I don't know which. But in my case the
overlappingness is tested for many characters and one constant
clippath, so I should calculate the upath of the clippath once and
store it in a variable.

3. Many thanks for the prompt and expert help.

jdaw1

unread,
Nov 12, 2006, 9:11:04 AM11/12/06
to
4. Is there a neat way to test whether the current path is protected?

Chapman Flack

unread,
Nov 12, 2006, 1:29:47 PM11/12/06
to
jdaw1 wrote:
> 4. Is there a neat way to test whether the current path is protected?

You could use the 'stopped' operator to execute upath, and
check the result.

-Chap

jdaw1

unread,
Nov 12, 2006, 4:26:42 PM11/12/06
to
Thank you again. I now have the pieces; it's time to write the code.

jdaw1

unread,
Nov 15, 2006, 3:36:07 PM11/15/06
to
Thanks again. The code is at
http://www.jdawiseman.com/papers/trivia/glasses.ps
and the documentation at
http://www.jdawiseman.com/papers/trivia/glasses.html
the relevant routine being RepeatClippedWithin .

For an example of what it does add some text to the items of
SubTitles[ ... ], and change the def of both OverlapSubTitlesOnTitles
and SubTitlesClippedWithinTitles to true.

The bug in Acrobat Professional described in
http://groups.google.com/group/comp.lang.postscript/browse_thread/thread/d939df0dde60335c/
still causes some imperfections in the printed version, but I'll have
to live with that.

Chapman Flack

unread,
Nov 16, 2006, 10:55:53 AM11/16/06
to
jdaw1 wrote:
> and the documentation at
> http://www.jdawiseman.com/papers/trivia/glasses.html
> the relevant routine being RepeatClippedWithin .

Very nice!

Did you measure any effect on your run time of saving
the clippath with 'true upath' rather than 'false upath'?
I might naively think that your application, with many
tests against the same saved path, could benefit from
caching of the path.

-Chap

jdaw1

unread,
Nov 16, 2006, 1:12:03 PM11/16/06
to
Ahh, that's what the boolean parameter to upath does -- thank you
again. I will test it this evening.

jdaw1

unread,
Nov 16, 2006, 10:02:36 PM11/16/06
to
Seems to trim some 30% off the distil time --- good idea, thank you yet
again. Other suggestions welcomed.

Chapman Flack

unread,
Nov 17, 2006, 9:31:10 AM11/17/06
to
jdaw1 wrote:
> Seems to trim some 30% off the distil time --- good idea, thank you yet

Good to know - I hacked up an InUPathDecode filter
(give it a upath, bbox, and resolution, and read it out
as a 1 bpp b/w image stream) and I assumed that
'true upath' would be the way to go, but I hadn't
actually benchmarked it against 'false upath' to check
my assumption. :)

-Chap

0 new messages