chiark / gitweb /
poster-tube-lid: wip parametric integration
[reprap-play.git] / poster-tube-lid-parametric.scad.pl
index 9fa0b2e1cdbd5c02e8c9ad229d36c4e812a4046a..bbe70d93ad7c195288fdbf1066ceedc62c748333 100755 (executable)
@@ -16,12 +16,14 @@ my $slope_angle = 45 * TAU/360;
 my $jcurverad = 5;
 my $tall = 50;
 
-my $lin_len = 5;
+my $lin_len = 4;
 my $sine_size = 10;
-my $sine_angle = TAU/8;
+my $sine_angle = 1.2 * TAU/8;
 
 my $ballend_xr = $thick/2;
 
+my $skew_slope = 0.7;
+
 my @i_sections = qw(ball0  -6
                    sine0  -10
                    -
@@ -74,10 +76,10 @@ sub point ($$$$) {
                     );
     } elsif ($ip =~ m/^ball[02]$/) {
        my $angle = $it * TAU/4;
-       $i_offset = V( -$lin_len -$sine_len
-                      -sin($angle) * $ballend_xr,
+       my $dx = sin($angle) * $ballend_xr;
+       $i_offset = V( -$lin_len -$sine_len - $dx,
                       0,
-                      +$sine_height
+                      +$sine_height + $dx * tan($sine_angle)
                     );
        $i_thickscale = cos($angle);
     } else {
@@ -120,6 +122,13 @@ sub point ($$$$) {
        die "$jp ?";
     }
 
+    if ($i_offset->[0] < 0) {
+       my $base = $large_dia/2 + 3.0*($large_dia - $small_dia)/2;
+       $i_offset->[0] *=
+           ($base - $j_x) /
+           ($base - $small_dia/2);
+    }
+
 #    print STDERR "@_ $j_x $j_y $i_offset $i_outward\n";
     return
        $i_offset +