【发布时间】:2014-04-23 02:14:57
【问题描述】:
我目前正在为 Postscript 编译器编写徽标。我的 PS 输出代码似乎无效。任何想法可能是什么问题?或者 LOGO 的实际 PostScript 版本应该是什么样子?
LOGO输入代码
PROC LDRAGON ( LEVEL )
IF LEVEL == 0 THEN
FORWARD 5
ELSE
LDRAGON ( LEVEL - 1 )
LEFT 90
RDRAGON ( LEVEL - 1 )
ENDIF
PROC RDRAGON ( LEVEL )
IF LEVEL == 0 THEN
FORWARD 5
ELSE
LDRAGON ( LEVEL - 1 )
RIGHT 90
RDRAGON ( LEVEL - 1 )
ENDIF
PROC MAIN (VOID)
LDRAGON ( 11 )
来自我的编译器的代码。
%!PS-Adobe-3.0
/Xpos { 300 } def showpage
/Ypos { 500 } def
/Heading { 0 } def
/Arg { 0 } def
/Right {
Heading exch add Trueheading
/Heading exch def
} def
/Left {
Heading exch sub Trueheading
/Heading exch def
} defп
/Trueheading {
360 mod dup
0 lt { 360 add } if
} def
/Forward {
dup Heading sin mul
exch Heading cos mul
2 copy Newposition
rlineto
} def
/Newposition {
Heading 180 gt Heading 360 lt
and { neg } if exch
Heading 90 gt Heading 270 lt
and { neg } if exch
Ypos add /Ypos exch def
Xpos add /Xpos exch def
} def
/LEVEL { 11 } def
/LDRAGON{
LEVEL
0
eq
{
5 FORWARD }{
LEVEL
1
1
sub
LDRAGON
90
LEFT
LEVEL
1
sub
RDRAGON
} ifelse
} def
/MAIN {
11
LDRAGON
} def
Xpos Ypos moveto
MAIN
stroke
showpage
【问题讨论】:
-
从 Scheme 生成 Postscript 的类似问题:stackoverflow.com/questions/8549026/rotate-to-north
标签: postscript logo-lang