Tuesday, March 17, 2015

Quilts: Finding the Number of Blocks That Fit in a Rectangle

Quilts:  Finding the Number of Blocks That Fit in a Rectangle


The program QUILT will find the number of small tiles that will fit in a large rectangular quilt (this can be applied to game boards, posters, or other decorative items).  QUILT will also calculate the number of columns and rows of tiles you will have, and the leftover area.  The idea is to minimize the area that remains after placing the maximum amount of tiles.  I will assume that no tiles will be cut in the process. 

Fitting Tiles to a Quilt
 Where:
bw = width of the quilt (labeled A on the Prizm program QUILT)
bl = length of the quilt (labeled B on the Prizm program QUILT)
sw = width of the tile (labeled C on the Prizm program QUILT)
sl = length of the tile (labeled D on the Prizm program QUILT)

Formulas

Number of tiles that can fit:
n = floor(bw/sw) * floor(bl/sl) = int(bw/sw) * int(bl/sl)
where floor is the floor function and int represents the integer function.  Essentially, you want the integer (whole number) portion of the divisions sw/sl and bw/bl and disregard the fraction part.

Number of columns of tiles = floor(bw/bl)

Number of rows of tiles = floor(sw/sl)

Leftover area = bw * bl – n * sw * sl

Thanks to


Casio Prizm: QUILT

“QUILT WIDTH AND”
“LENGTH:”
? -> A
? -> B
“TILE WIDTH AND”
“LENGTH:”
? -> C
? -> D
Int (A÷C) * Int (B÷D) -> N
AB – NCD -> L
“NUMBER OF TILES”
N
“COLUMNS=”
Int (A÷C)
“ROWS=”
Int (B÷D)
“AREA LEFTOVER=”
L


HP Prime:  quilt

quilt()
BEGIN
LOCAL bw, bl, sw, sl, n, l;
INPUT({bw,bl},”Quilt”,{“Width:”, “Length:”});
INPUT({sw,sl},”Tile”,{“Width:”, “Length:”});
n:=FLOOR(bw/sw)*FLOOR(bl/sw);
l:=bw*bl-sw*sl*n;
PRINT()
PRINT(“# of tiles = “+ n);
PRINT(“# of columns = “+FLOOR(bw/sw));
PRINT(“# of rows = “+FLOOR(bl/sl));
PRINT(“Leftover Area = “+l);
RETURN {n,FLOOR(bw/sw),FLOOR(bl/sl),l};
END;

Examples

Example 1:
We have a quilt that measures 40” by 54” and we want to fit as many tiles measuring 2” by 3”.  Hence:  bw = 40, bl = 54, sw = 2, and sl = 3.

Result: 
Number of tiles:  360
Number of columns: 20
Number of rows: 18
Leftover area:  0  (perfect fit!)

Example 2:
We have a quilt that measures 48” by 54” and we want to fit as many tiles measuring 5” by 5”.  Hence:  bw = 48, bl = 54, sw = 5, and sl = 5.

Result: 
Number of tiles:  90
Number of columns: 9
Number of rows: 10
Leftover area:  342 sq inches  (perfect fit!)


Happy St. Patrick’s Day!

Eddie


This blog is property of Edward Shore.  2015

  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...