Created
February 17, 2021 22:27
-
-
Save BruceMcKinnon/fd06c963ad068d087551c274c21b73fa to your computer and use it in GitHub Desktop.
Volume of a bag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// calcBagVolume() - Calculate the volume of a bag or satcel. Provide the width/height dimensions in cms and get the volume in litres | |
function calcBagVolume($length,$width) { | |
// https://mathworld.wolfram.com/PaperBagSurface.html | |
$volume = pow($width,3) * ( ( $length / (pi() * $width) ) - ( 0.142 * ( 1 - (pow(10,(0-($length/$width)) ) ) ) ) ); | |
$litres = $volume / 1000; | |
return $litres; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment