chiark / gitweb /
fairphone-case: rework hingescrew parameters: introduce hingemount_wd and use for...
[reprap-play.git] / utils.scad
1 // -*- C -*-
2
3 // suitable for masking things within radius sqrt(2) only
4 module FArcSegment_mask(beta) {
5   for (i=[0 : 0.75 : 3]) {
6     rotate(i*beta/4)
7       polygon([[0, 0],
8                [1, 0],
9                [cos(beta/4), sin(beta/4)]]);
10   }
11 }
12
13 module FArcSegment(xc,yc,inrad,outrad,alpha,delta) {
14   translate([xc,yc]) {
15     intersection() {
16       difference() {
17         circle(r=outrad, $fn=70);
18         circle(r=inrad, $fn=70);
19       }
20       rotate(alpha) scale(outrad*2) {
21         FArcSegment_mask(delta);
22       }
23     }
24   }
25 }
26
27 module rectfromto(a,b) {
28   ab = b - a;
29   translate([min(a[0], b[0]), min(a[1], b[1])])
30     square([abs(ab[0]), abs(ab[1])]);
31 }
32 module circleat(c,r) { translate(c) circle(r); }
33 module linextr(z0,z1) {
34   translate([0,0,z0])
35     linear_extrude(height=z1-z0)
36     children();
37 }