chiark / gitweb /
poster-tube-lid: wip parametric integration, rework
[reprap-play.git] / poster-tube-lid-parametric.scad.pl
index f30aea465b5666eeab6b2c3e2a284a98db19e2c2..9fa0b2e1cdbd5c02e8c9ad229d36c4e812a4046a 100755 (executable)
@@ -17,9 +17,8 @@ my $jcurverad = 5;
 my $tall = 50;
 
 my $lin_len = 5;
-my $lin2_len = 9;
-my $sine_len = 6;
-my $sine_height = 6;
+my $sine_size = 10;
+my $sine_angle = TAU/8;
 
 my $ballend_xr = $thick/2;
 
@@ -31,7 +30,6 @@ my @i_sections = qw(ball0  -6
                    lin1    2
                    sine1  10
                    -
-                   lin2   -2
                    ball2   6
                    -
                    );
@@ -56,6 +54,8 @@ sub point ($$$$) {
                    0 );
 
     my $i_thickscale = 1.0;
+    my $sine_len = $sine_size * sin($sine_angle);
+    my $sine_height = $sine_size * (1 - cos($sine_angle));
 
     if ($ip =~ m/^lin[01]$/) {
        $i_offset = V( -$lin_len * $it,
@@ -66,19 +66,15 @@ sub point ($$$$) {
        $i_outward = V(  sin($it * TAU/2),
                         -cos($it * TAU/2),
                         0 );
-    } elsif ($ip =~ m/^lin2$/) {
-       $i_offset = V( -$lin_len -$sine_len - $it*$lin2_len,
-                      0,
-                      +$sine_height );
     } elsif ($ip =~ m/^sine[01]$/) {
-       $i_offset = V( -$lin_len -$it*$sine_len,
+       my $angle = $it * $sine_angle;
+       $i_offset = V( -$sine_size * sin($angle) -$lin_len,
                       0,
-                      $sine_height * ( 0.5 - 0.5*cos( $it*TAU/2 ) )
+                      +$sine_size * (1 - cos($angle))
                     );
     } elsif ($ip =~ m/^ball[02]$/) {
        my $angle = $it * TAU/4;
        $i_offset = V( -$lin_len -$sine_len
-                      -($ip =~ m/2/ ? $lin2_len : 0)
                       -sin($angle) * $ballend_xr,
                       0,
                       +$sine_height