groff
[Top][All Lists]
Advanced

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

Re: [Groff] couple of questions regarding pic


From: Jon Snader
Subject: Re: [Groff] couple of questions regarding pic
Date: Fri, 18 Aug 2000 11:17:55 -0400

On Fri, Aug 18, 2000 at 01:21:59PM +0100, Ted Harding wrote:
> On 17-Aug-00 Wolfgang Huber wrote:
> > 
> > 1) is it possible to rotate an object?
> > for example "box rotated 45 degrees"?
> > (i know i could input an eps-file but I would prefer a pic-solution)
> 
> As things stand, unfortunately not. It would be very useful, especially
> since box, circle and ellipse are the only pic objects that can be
> filled, but they are restricted to being aligned with the axes of
> the page.
> 
> If you just want the outline of the box (i.e. its four edges) you can
> always write a pic macro to do it, but you won't be able to fill it
> (since it will emerge simply as four lines). E.g.
> 
> .PS
> define rbox {
> w = $1
> h = $2
> t = $3
> cx = Here.x
> cy = Here.y
> 
> blx = cx + 0.5*h*sin(t)
> bly = cy - 0.5*h*cos(t)
> brx = blx + w*cos(t)
> bry = bly + w*sin(t)
> ulx = blx - h*sin(t)
> uly = bly + h*cos(t)
> urx = ulx + w*cos(t)
> ury = uly + w*sin(t)
> 
> line from (blx,bly) to (brx,bry) to (urx,ury) to (ulx,uly) to (blx,bly)
> 
> }
> 
> pi = 4*atan2(1,1)
> move to (3,3)
> box wid 1 ht 1
> move to (3,3)
> rbox(1,1,pi/10)
> 
> .PE
> 
> 

You can trick pic into passing troff graphics commands by putting
them in quotes.  Here's a rotated, filled box generated inside of
pic.  I'll leave it to Wolfgang to make this into an eas(ier) to
use macro.

Here is a filled, rotated  box
.sp 2
.PS
"\D'f 300u'"                                            #set fill
"\D'P 1i 1i 1i -1i -1i -1i'"            #draw box
.PE

Jon Snader

reply via email to

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