首页 文章

LOGO到PostScript

提问于
浏览
0

我正在尝试在PostScript中为我的LOGO程序找到相同的代码:

PROC FRACTAL( SIZE )
IF SIZE < 1 THEN
FORWARD 5
ELSE 
LEFT 90
RIGHT 90
RIGHT 90
RIGHT 90
RIGHT 90
RIGHT 90
FORWARD 60
ENDIF

PROC MAIN( VOID )
FRACTAL( 5 )

到目前为止我得到了

%!
%(debug.ps/db5.ps)run traceon stepon currentfile cvx debug
/Xpos { 300 } def
/Ypos { 500 } def
/Heading { 0 } def
/Arg { 0 } def
/RIGHT {
Heading exch add Trueheading
/Heading exch store
} def
/LEFT {
Heading exch sub Trueheading
/Heading exch store
} 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
/SIZE { 5 } def
/FRACTAL{
1 dict begin
/SIZE exch def
SIZE
1
lt
{
5
FORWARD
}{
90
LEFT
90
RIGHT
90
RIGHT
90
RIGHT
90
RIGHT
90
RIGHT
60
FORWARD
} ifelse 
end
} def
/MAIN{
5
FRACTAL
} def
Xpos Ypos moveto
MAIN
stroke
showpage

此解决方案基于此问题:Logo to PostScript mini-Compiler

这段代码对我来说很好,但由于某些原因PS不想显示图片 .

1 回答

  • 1

    后记翻译是正确的 . 问题是Logo程序没有做任何有趣的事情 .

相关问题