IT/기타

postscript object rotation, scaling 연습

smores 2015. 1. 31. 05:22

회전 후 역회전

scale 후 scale back (1/scalefactor)





%!PS-Adobe-

306 396 translate 0.900000 0.900000 scale 0 setlinewidth


-300 -300 moveto -300 300 lineto 300 300 lineto 300 -300 lineto -300 -300 lineto stroke


/np { newpath } def


/ellipsedict 8 dict def

ellipsedict /mtrx matrix put

/ellipse

{ ellipsedict begin

  /endangle exch def

  /startangle exch def

  /yrad exch def

  /xrad exch def

  /y exch def

  /x exch def

  /savematrix mtrx currentmatrix def

  x y translate

  xrad yrad scale

  0 0 1 startangle endangle arc

  savematrix setmatrix

  end

} def


/square

{

-1.5 -1.5 rmoveto 3.000 0.000 rlineto 0.000 3.000 rlineto -3.000 0.000 rlineto 0.000 -3.000   0.0 0.0 0.0 setrgbcolor fill

} def



/ft1 {

1 3.5 0 360 ellipse 1 0 0 setrgbcolor fill

} def



np 0.000 0.000 moveto square

np 10.000 0.000 moveto 30 rotate 2 2 scale square 0.5 0.5 scale -30 rotate

np 0.000 20.000 moveto 45 rotate square -45 rotate



np -10 -10 ft1

np 20 20 ft1

np 30 30 30 rotate ft1 -30 rotate




showpage