2009年10月29日 星期四

作業4-菱形漸層



size 200 200
paper 100
command square x y s c
{
pen (1+(c*6)) (15+c) c
line x y (x+(s/2)) (y+s)
line (x+(s/2)) (y+s) (x+s) y
line (x+s) y x y
}
command square2 x y s c
{
pen (1+(c*6)) (15+c) c
line (x-s) y x y
line x y (x-(s/2)) (y-s)
line (x-(s/2)) (y-s) (x-s) y
}
command square3 x y s c
{
pen (1+(c*6)) (15+c) c
line x y (x+(s/2)) (y+s)
line (x+(s/2)) (y+s) (x+s) y
line (x+s) y (x+(s/2)) (y-s)
line (x+(s/2)) (y-s) x y
}

repeat D 15 23
{
repeat A 0 4
{
repeat B 0 3
{
square3 (30+(A+A)*15) (28+(B+B)*23) D ((A+B)*8)
}
}
}

2009年10月22日 星期四

英倫菱形格子

Load dbngraphics.dbn
size 300 300
paper 30
fast



set M 50


//白色區塊
Repeat A 0 50
{
pen 0
triangle 0 0 (M/2) A M 0
triangle (M*2) 0 (M*2+25) A (M*3) 0
triangle (M*4) 0 (M*4+25) A (M*5) 0
}

Repeat C 100 150
{
pen 0
triangle (M+25) C M (M*2) (M*2) (M*2)
triangle (M*3+25) C (M*3) (M*2) (M*4) (M*2)
triangle (M*5+25) C (M*5) (M*2) (M*6) (M*2)
}

Repeat C 100 50
{
pen 0
triangle (M+25) C M (M*2) (M*2) (M*2)
triangle (M*3+25) C (M*3) (M*2) (M*4) (M*2)
triangle (M*5+25) C (M*5) (M*2) (M*6) (M*2)
}

Repeat E 200 250
{
pen 0
triangle (M/2) E 0 (M*4) M (M*4)
triangle (M*2+25) E (M*2) (M*4) (M*3) (M*4)
triangle (M*4+25) E (M*4) (M*4) (M*5) (M*4)
}

Repeat E 200 150
{
pen 0
triangle (M/2) E 0 (M*4) M (M*4)
triangle (M*2+25) E (M*2) (M*4) (M*3) (M*4)
triangle (M*4+25) E (M*4) (M*4) (M*5) (M*4)
}

Repeat G 300 250
{
pen 0
triangle (M+25) G M (M*6) (M*2) (M*6)
triangle (M*3+25) G (M*3) (M*6) (M*4) (M*6)
triangle (M*5+25) G (M*5) (M*6) (M*6) (M*6)
}


//黑色區塊
//第一行
Repeat B 50 0
{
pen 100
triangle 0 B 0 B (M/2) M
triangle M B (M/2) M (M+25) M
triangle (M*2) B (M+25) M (M*2+25) M
triangle (M*3) B (M*2+25) M (M*3+25) M
triangle (M*4) B (M*3+25) M (M*4+25) M
triangle (M*5) B (M*4+25) M (M*5+25)M
triangle (M*6) B (M*5+25) M (M*6) M
}

//第二行
Repeat B 50 100
{
pen 100
triangle 0 B 0 B (M/2) M
triangle M B (M/2) M (M+25) M
triangle (M*2) B (M+25) M (M*2+25) M
triangle (M*3) B (M*2+25) M (M*3+25) M
triangle (M*4) B (M*3+25) M (M*4+25) M
triangle (M*5) B (M*4+25) M (M*5+25)M
triangle (M*6) B (M*5+25) M (M*6) M
}



//第三行
Repeat D 150 100
{
pen 100
triangle 0 D 0 (M*3) (M/2) (M*3)
triangle M D (M/2) (M*3) (M+25) (M*3)
triangle (M*2) D 75 (M*3) (M*2+25) (M*3)
triangle (M*3) D 125 (M*3) (M*3+25) (M*3)
triangle (M*4) D 175 (M*3) (M*4+25) (M*3)
triangle (M*5) D 225 (M*3) (M*5+25) (M*3)
triangle (M*6) D 275 (M*3) (M*6) (M*3)


}
//第四行
Repeat D 150 200
{
pen 100
triangle 0 D 0 (M*3) (M/2) (M*3)
triangle M D (M/2) (M*3) (M+25) (M*3)
triangle (M*2) D 75 (M*3) (M*2+25) (M*3)
triangle (M*3) D 125 (M*3) (M*3+25) (M*3)
triangle (M*4) D 175 (M*3) (M*4+25) (M*3)
triangle (M*5) D 225 (M*3) (M*5+25) (M*3)
triangle (M*6) D 275 (M*3) (M*6) (M*3)

}



//第五行
Repeat F 250 200
{
pen 100
triangle 0 F 0 (M*5) (M/2) (M*5)
triangle M F (M/2) (M*5) (M+25) (M*5)
triangle (M*2) F (M+25) (M*5) (M*2+25) (M*5)
triangle (M*3) F (M*2+25) (M*5) (M*3+25) (M*5)
triangle (M*4) F (M*3+25) (M*5) (M*4+25) (M*5)
triangle (M*5) F (M*4+25) (M*5) (M*5+25) (M*5)
triangle (M*6) F (M*5+25) (M*5) (M*5+25) (M*5)
}

//第六行
Repeat F 250 300
{
pen 100
triangle 0 F 0 (M*5) (M/2) (M*5)
triangle M F (M/2) (M*5) (M+25) (M*5)
triangle (M*2) F (M+25) (M*5) (M*2+25) (M*5)
triangle (M*3) F (M*2+25) (M*5) (M*3+25) (M*5)
triangle (M*4) F (M*3+25) (M*5) (M*4+25) (M*5)
triangle (M*5) F (M*4+25) (M*5) (M*5+25) (M*5)
triangle (M*6) F (M*5+25) (M*5) (M*5+25) (M*5)
}

//線
pen 100

line 0 50 25 0
line 0 150 75 0
line 0 250 125 0
line 0 350 175 0
line 0 450 225 0
line 0 550 275 0
line 0 650 325 0
line 0 750 375 0
line 0 850 425 0

line 25 300 -125 0
line 75 300 -75 0
line 125 300 -25 0
line 175 300 25 0
line 225 300 75 0
line 275 300 125 0
line 325 300 175 0
line 375 300 225 0
line 425 300 275 0

2009年10月15日 星期四

pattern - 紅黃藍世界




size 175 100

Repeat A 0 2
{
pen 100
Line A 0 A 100
pen 100
Line 0 A 175 A
pen 100
Line (172+A) 0 (172+A) 100
pen 100
Line 0 (97+A) 175 (97+A)
pen 100
Line 60 (80+A) 175 (80+A)
pen 100
Line 8 (10+A) 175 (10+A)
pen 100
Line 0 (40+A) 145 (40+A)
pen 100
Line (8+A) 0 (8+A) 100
pen 100
Line (60+A) 40 (60+A) 100
pen 100
Line (75+A) 0 (75+A) 80
pen 100
Line (145+A) 10 (145+A) 100
pen 100
Line (125+A) 10 (125+A) 40
}
Repeat B 8 56
{
pen 100 0 0
Line (B+3) 43 (B+3) 96
}
Repeat C 171 148
{
pen 0 0 100
Line C 13 C 79
}
Repeat D 79 43
{
pen 100 100 0
Line 78 D 144 D
}
Repeat E 13 39
{
pen 100
Line 11 E 75 E
}
Repeat F 9 3
{
pen 100 0 0
Line 78 F 171 F
}
Repeat G 148 171
{
pen 100
Line G 83 G 97
}
Repeat H 79 43
{
pen 0 0 100
Line 63 H 74 H
}

2009年10月1日 星期四

作業1


// enter program
size 400 300

paper 80

pen 0

line 0 275 50 275
line 50 275 25 250
line 25 250 50 225
line 50 225 25 225
line 25 225 25 0
line 50 275 125 275
line 50 250 125 250
line 50 250 50 200
line 50 200 125 200
line 125 250 125 200
line 50 225 125 225
line 85 300 85 150
line 85 200 50 150
line 85 200 150 125
line 127 150 225 225
line 225 225 250 195
line 175 125 200 145
line 185 115 205 130
line 195 122 195 0
line 200 125 220 95
line 220 95 400 225
line 215 155 245 178
line 220 180 265 127
line 265 127 250 125
line 225 145 245 135
line 300 152 300 0
line 315 100 400 100
line 375 150 315 50
line 335 80 335 10
line 335 80 385 80
line 385 80 385 10
line 385 10 335 10