mirror of
https://github.com/LucasVbr/postscript-compiler.git
synced 2026-05-13 17:22:00 +00:00
Add .gitignore
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/* Declaration of native Postscript procedures / functions */
|
||||
|
||||
void newpath ();
|
||||
void moveto(float x, float y);
|
||||
void rlineto(float x, float y);
|
||||
void closepath();
|
||||
void stroke ();
|
||||
|
||||
/* Function definition */
|
||||
|
||||
void rectangle(float x, float y, float a, float b) {
|
||||
newpath();
|
||||
moveto(x, y);
|
||||
rlineto(a, 0.);
|
||||
rlineto(0., b);
|
||||
rlineto(0. -. a, 0.);
|
||||
rlineto(0., 0. -. b);
|
||||
closepath();
|
||||
stroke();
|
||||
}
|
||||
|
||||
void square(float x, float y, float a) {
|
||||
rectangle(x, y, a, a);
|
||||
}
|
||||
|
||||
void fig1a(int d, float x, float y, float a) {
|
||||
if (d != 0) {
|
||||
square(x, y, a);
|
||||
fig1a(d - 1, x, y, a /. 2.);
|
||||
}
|
||||
}
|
||||
|
||||
void fig1b(int d, float x, float y, float a) {
|
||||
if (d != 0) {
|
||||
square(x, y, a);
|
||||
fig1b(d - 1, x +. a, y +. a, a /. 2.);
|
||||
}
|
||||
}
|
||||
|
||||
void main () {
|
||||
fig1a(5, 200., 450., 100.);
|
||||
fig1b(5, 100., 200., 100.);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user