groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] More on rotation in PIC


From: Ted Harding
Subject: [Groff] More on rotation in PIC
Date: Sun, 03 Jan 2010 17:53:31 -0000 (GMT)

Another example to contemplate. As usual:

  groff -Tps -p input.tr output.ps

(plus any macro option, etc., that you use).


.blm
.ds rotate "\X'ps: exec gsave currentpoint 2 copy translate \
\\$1 rotate neg exch neg exch translate'
.ds restore "\X'ps: exec grestore'
.PS
define rotated  { "\*[rotate $1]" at ($2,$3) }
define thing {
  sc = $1 # scale factor
  x0 = $2 ; y0 = $3 # reference point
  ellipse ht sc*1 wid sc*0.5 with .s at (sc*x0,sc*y0)
  circle rad sc*0.25 with .s at last ellipse .n
  line from last circle .n up sc*0.3 left sc*0.1
  line from last circle .n up sc*0.3 right sc*0.1
  ellipse ht sc*0.6 wid sc*0.15 with .n at last ellipse .sw
  ellipse ht sc*0.6 wid sc*0.15 with .n at 2nd last ellipse .se
}
box ht 0.5 wid 2.0 at (0.0,3.0) "Top Box"
nextx = 0.0 ; dx = 0.50 
nexty = 0.0 ; dy = -0.50
thing(1.0,nextx,nexty)
nextx = nextx + dx ; nexty = nexty + dy
rotated(15,nextx,nexty)
  thing(0.75,nextx,nexty)
  nextx = nextx + dx ; nexty = nexty + dy
  rotated(15,nextx,nexty)
    thing(0.75*0.75,nextx,nexty)
    nextx = nextx + dx ; nexty = nexty + dy
    rotated(15,nextx,nexty)
      thing(0.75*0.75*0.75,nextx,nexty)
      nextx = nextx + dx ; nexty = nexty + dy
      rotated(15,nextx,nexty)
        thing(0.75*0.75*0.75*0.75,nextx,nexty)
      "\*[restore]"
    "\*[restore]"
  "\*[restore]"
"\*[restore]"
box ht 0.25 wid 1.0 at (2.75,-1.25) "Bottom Box"
.PE



Ted.



--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 03-Jan-10                                       Time: 17:52:22
------------------------------ XFMail ------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]