/[cvs]/fract/fudge.py
ViewVC logotype

Annotation of /fract/fudge.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Sat Feb 24 15:57:15 2001 UTC (23 years, 9 months ago) by teddy
Branch: masse, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-python
Imported sources (take 2)

1 teddy 1.1 #!/usr/bin/python
2    
3     def normal(kord1,kord2):
4     x1,y1= kord1
5     x2,y2= kord2
6     x3= 0.5*(x2-x1+(y2-y1)/2)+x1
7     y3= 0.5*(y2-y1-(x2-x1)/2)+y1
8     return x3, y3
9    
10     def transform(inbase):
11     outbase= []
12     for it in range(len(inbase)-1):
13     (x1,y1)= inbase[it]
14     (x2,y2)= inbase[it+1]
15     outbase.append((x1,y1))
16     if it%2 == 0:
17     outbase.append(normal((x1,y1),(x2,y2)))
18     else:
19     outbase.append(normal((x2,y2),(x1,y1)))
20     outbase.append(inbase[-1])
21     return outbase
22    
23     def draw(inbase):
24     print "#PLOT 2"
25     print "o"
26     print "e"
27     for it in range(len(inbase)-1):
28     x1,y1= inbase[it]
29     x2,y2= inbase[it+1]
30     print "l", x1, y1, x2, y2
31     print "x"
32    
33     base= [(142,142), normal((142,142),(426,142)),
34     (426,142), normal((426,142),(285,389)),
35     (285,389), normal((285,389),(142,142)), (142,142)]
36    
37     for i in range(10):
38     base= transform(base)
39    
40     draw(base)
41    

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26