1patternScale = 5.0875;
2patternThickness = 0.6;
3patternDepth = 2;
4repeatX = 4;
5repeatY = 2;
6
7module drawLine(a=0,b=0,xStart=0,xEnd=0)
8{
9 lineLength = sqrt(pow(a*(xEnd-xStart),2)+pow(xEnd-xStart,2))+patternThickness;
10 translate([xStart,a*xStart+b,0])
11 rotate([0,0,atan(a)]) translate ([-patternThickness/2,-patternThickness/2,-patternDepth/2]) cube([lineLength,patternThickness,patternDepth]);
12}
13
14module drawYLine(xOrig=0,yOrig=0,length=0)
15{
16 lineLength = length+patternThickness;
17 translate([xOrig,yOrig,0])
18 rotate([0,0,90]) translate ([-patternThickness/2,-patternThickness/2,-patternDepth/2]) cube([lineLength,patternThickness,patternDepth]);
19}
20
21
22module asanoha(){
23
24 interXT = patternScale/(1+tan(67.5));
25
26 drawLine(0,0,0,patternScale);
27 drawLine(-1,0,0,interXT);
28 drawLine(tan(67.5),-patternScale,0,interXT);
29 drawLine(tan(22.5),-patternScale*tan(22.5),interXT,patternScale);
30
31
32 interXB = patternScale/(1+tan(22.5));
33
34 drawLine(0,-patternScale,0,patternScale);
35 drawLine(-1,0,interXB,patternScale);
36 drawLine(tan(22.5),-patternScale,0,interXB);
37 drawLine(tan(67.5),-patternScale*tan(67.5),interXB,patternScale);
38
39
40 drawLine(1,-patternScale,0,patternScale);
41 drawYLine(0,-patternScale,patternScale);
42 drawYLine(patternScale,-patternScale,patternScale);
43}
44
45module movePattern(repeatXN=0,repeatYN=0){
46 translate([patternScale*2*repeatXN,patternScale*2*repeatYN,0]) children();
47}
48
49module fullAsanoha(){
50 asanoha();
51 rotate([0,0,90]) translate([-patternScale,-patternScale,0]) asanoha();
52 rotate([0,0,90]) asanoha();
53 translate([patternScale,patternScale,0]) asanoha();
54}
55
56module drawAsanoha(){
57 translate([0,patternScale,patternDepth/2])
58// Actually start drawing things
59for(repeatXN = [0 : repeatX-1]){
60 for(repeatYN = [0 : repeatY-1]){
61 movePattern(repeatXN,repeatYN) fullAsanoha();
62 }
63}
64
65}