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

What's arcto good for?

63 views
Skip to first unread message

luser droog

unread,
Jun 25, 2019, 6:29:58 PM6/25/19
to
What's 'arcto' good for? It arose mysteriously after the original red book
apparently to help make rounded corners for screen windows and boxes.
But I could never figure out how to use it. Does anybody use it?

It seems like it might be applicable to my issue in Julian's thread about
the stylized '9' where I have the spans from one side of a strokepath but
no joins.

edspike...@gmail.com

unread,
Jun 26, 2019, 11:11:46 AM6/26/19
to
%!
% draw rectangle with rounded corner : x y width height radius
/rectar {
4 index 3 index 2 div add % x y w h r (x + w/2)
4 index % x y w h r x y
moveto % x y w h r

4 index 3 index add 4 index % x y w h r x2 y2
1 index 1 index 5 index neg add % x y w h r x2 y2 x3 y3
4 index % x y w h r x2 y2 x3 y3 r
arcto 4 {pop} repeat % x y w h r

4 index 3 index add % x y w h r x3
4 index 3 index neg add % x y w h r x3 y3
6 index 1 index % x y w h r x3 y3 x4 y4
4 index % x y w h r x3 y3 x4 y4 r
arcto 4 {pop} repeat % x y w h r

4 index 4 index 3 index neg add % x y w h r x4 y4
6 index 6 index % x y w h r x4 y4 x y
4 index
arcto 4 {pop} repeat % x y w h r

4 index 4 index % x y w h r x y
1 index 5 index add 1 index % x y w h r x y x2 y2
4 index
arcto 4 {pop} repeat % x y w h r

closepath
5 {pop} repeat % clean stack
stroke
} def

/wid 10 def
wid setlinewidth
/x 400 def
/y 400 def
/dx 100 def
/dy 50 def
/rad wid def
x y dx dy rad rectar
showpage

Mark Carroll

unread,
Jun 29, 2019, 4:17:29 AM6/29/19
to
On 25 Jun 2019, luser droog wrote:

> What's 'arcto' good for? It arose mysteriously after the original red book
> apparently to help make rounded corners for screen windows and boxes.
> But I could never figure out how to use it. Does anybody use it?

A glance through some code suggests that I do not; for that kind of
thing I tend to use curveto. I do notice arcto cropping up in some Xfig
diagrams converted by fig2dev though.

-- Mark

John Reiser

unread,
Jun 29, 2019, 10:23:21 AM6/29/19
to
On 6/25/19 22:29 UTC, luser droog wrote:
> What's 'arcto' good for?

The arc is a portion of a circle, which is easier to draw
than a general bezier curve. The same DDA (digital difference
analyzer) that draws a 2D line on a grid of square pixels,
can be trivially modified to draw up to 1/8 of a circle.
The NEC 7220 graphics chip (circa 1981: 38 years ago)
had this enhancement. Among other things this was used
to draw the symbols for logic gates (NAND, NOR) at
varying scales into the frame buffer for a CRT display.
0 new messages