chiark / gitweb /
pawn wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 2 Oct 2012 16:57:00 +0000 (17:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 2 Oct 2012 16:57:00 +0000 (17:57 +0100)
pawn.scad

index 805c5f3..88113c1 100644 (file)
--- a/pawn.scad
+++ b/pawn.scad
@@ -28,18 +28,32 @@ x6 = x5 - h6 * tan(a6);
 $fa=1;
 $fs=0.1;
 
+module SegmentBasisSquare(zmin, zmax, xmin){
+  translate([xmin, zmin-0.01]) square([-xmin+0.01, zmax-zmin+0.02]);
+}
 module ConvexSegment(xc, zc, r, zmin, zmax){
   intersection(){
     translate([xc,zc]) circle(r=r);
-    translate([-50,zmin-0.01]) square([55,zmax-zmin+0.02]);
+    SegmentBasisSquare(zmin,zmax,-50);
+  }
+}
+module ConcaveSegment(xc, zc, r, zmin, zmax){
+  difference(){
+    SegmentBasisSquare(zmin,zmax, xc);
+    translate([xc,zc]) circle(r=r);
   }
 }
 
 module PawnTemplate(){
+  ConvexSegment(  x1 + r1,         z1,              r1, z1, 50);
+  ConvexSegment(  x1 + r2,         z1,              r2, z2, z1);
+  ConcaveSegment( x3 - r3,         z3,              r3, z3, z2);
+  ConcaveSegment( x3 - r4,         z3,              r4, z4, z3);
+  ConvexSegment(  x5 + r5*cos(a6), z5 - r5*sin(a6), r5, z5, z4);
+
+if(0)
   intersection(){
     union(){
-      ConvexSegment(x1 + r1, z1, r1, z1, 50);
-      ConvexSegment(x1 + r2, z1, r2, z2, z1);
       translate([x5 + r5 * cos(a6), z5]) circle(r=r5);
       polygon([[x6,z6-1],
               [x5,z5],