Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@andrewgilmartin
Created May 17, 2015 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgilmartin/83cbea7c9c39f50f1fe0 to your computer and use it in GitHub Desktop.
Save andrewgilmartin/83cbea7c9c39f50f1fe0 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
my $length_proportion = 5;
my $width_proportion = 2;
my $height_proportion = 1;
for my $volume ( ( 500, 120, 100, 85, 75, 60, 50, 40, 25, 10 ) ) {
my $n = ( $volume / $length_proportion / $width_proportion / $height_proportion ) ** (1/3);
my $l = $n * $length_proportion;
my $w = $n * $width_proportion;
my $h = $n * $height_proportion;
printf( "%d: %.2f %.2f %.2f\n", $volume, $l, $w, $h );
}
# END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment