make the twist parameterized

This commit is contained in:
Trammell Hudson 2015-01-27 20:36:40 -05:00
parent 81b4d566cd
commit e5a6c2ebe4

View File

@ -9,6 +9,7 @@ use strict;
my $sections = 12;
my $thickness = 50;
my $twist = 240.0;
my $radius = [70,0,0];
my $pi = 2*atan2(1,0);
@ -145,13 +146,13 @@ sub module
my $n = shift;
# Generate the six points for the triangles
my $p00 = rotate($pts->[0], $n*240.0/$sections, 2);
my $p01 = rotate($pts->[1], $n*240.0/$sections, 2);
my $p02 = rotate($pts->[2], $n*240.0/$sections, 2);
my $p00 = rotate($pts->[0], $n*$twist/$sections, 2);
my $p01 = rotate($pts->[1], $n*$twist/$sections, 2);
my $p02 = rotate($pts->[2], $n*$twist/$sections, 2);
my $p10 = rotate($pts->[0], ($n+1)*240.0/$sections, 2);
my $p11 = rotate($pts->[1], ($n+1)*240.0/$sections, 2);
my $p12 = rotate($pts->[2], ($n+1)*240.0/$sections, 2);
my $p10 = rotate($pts->[0], ($n+1)*$twist/$sections, 2);
my $p11 = rotate($pts->[1], ($n+1)*$twist/$sections, 2);
my $p12 = rotate($pts->[2], ($n+1)*$twist/$sections, 2);
# Now offset them by the radius, after flipping
$p00 = v3add($radius, rotate($p00, 90, 0));