/ examples / dragon / torus_knot_dragon_low_poly.scad
torus_knot_dragon_low_poly.scad
 1  use <bezier_curve.scad>
 2  use <ellipse_extrude.scad>
 3  use <path_extrude.scad>
 4  use <torus_knot.scad>
 5  use <util/reverse.scad>
 6  
 7  use <dragon_head_low_poly.scad>
 8  
 9  torus_knot_dragon_low_poly();
10  
11  module torus_knot_dragon_low_poly() {
12      phi_step = 0.04;
13  
14      knot = torus_knot(2, 3, phi_step);
15      dragon_body_path = reverse([for(i = [9:len(knot) - 3]) knot[i]]);
16  
17      body_shape = concat(
18          bezier_curve(0.25, 
19              [
20                  [30, -35], [16, 0], [4, 13], 
21                  [3, -5], [0, 26], [-3, -5],
22                  [-4, 13],  [-16, 0], [-30, -35]
23              ]
24          ),
25          bezier_curve(0.25, 
26              [[-22, -35], [-15, -45], [0, -55], [15, -45], [22, -35]]
27          )
28      );    
29  
30      
31      pts = [for(p = body_shape) p * 0.015];
32      p = dragon_body_path[0];
33      
34      path_extrude(pts, [p + [0.00001, 0.0000055, 0.000008], each dragon_body_path], scale = 0.9);
35  
36      translate([2.975, -0.75, -0.75])      
37      scale(0.01825)
38      rotate([-52, -9, -25]) 
39      dragon_head_low_poly(); 
40      
41      translate([1.84, 1.635, -0.885])
42      rotate([104.95, -154.35, 66.25])
43      ellipse_extrude(1.2, slices = 7, twist = 15)
44      scale(0.9 * 0.0150)
45          polygon(body_shape);
46  }