Created
April 17, 2012 13:52
-
-
Save tosbourn/2406097 to your computer and use it in GitHub Desktop.
Quick Calc Function
This file contains 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
/** | |
* Quick calc functionality. | |
* | |
* Make sure you pass values of the same metric (all inches, or all centimetres or whatever) | |
* @input fw int floor width. | |
* @input fl int floor length. | |
* @input tw int tile width. | |
* @input tl int tile length. | |
* | |
* @return int Number of tiles. | |
*/ | |
function floorCalc(fw, fl, tw, tl) { | |
var tiles_needed_length = ceil(parseInt(fl, 10) / parseInt(tl, 10)), | |
tiles_needed_width = ceil(parseInt(fw, 10) / parseInt(tw, 10)); | |
return tiles_needed_length * tiles_needed_width; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment