A 6x10x14 rectangular cuboid
is made by stacking together 6*10*14 = 840 unit cubes. An elliptic cone
having minor axis = 6 units; major axis = 10 units, and height = 14 units is cut out of the cuboid by means of an infinitely thin laser-like cutting tool.
How many unit cubes will stay undamaged inside the elliptic cone?
At the base, as given, the ellipse is 6x10, and at the top is 0x0. As one rises from the base, each loses 1/14 of its original value at each unit of height. So at a given height, h, above the base the elliptical cross section is (6*(1 - x/14)) x (10*(1 - x/14)).
At any level, call the smaller semidiameter r1 and the larger semidiameter r2. The distance from the center to one focus is sqrt(r2^2 - r1^2). The sum of the distances of any given point from the two foci is 2*r2. The point lies within the cone if the sum of its distances from the foci is less than 2*r2.
A given cube at a given level is within the body of the cone if the point on its top farthest from the center of its level is on or within the cone; that is, if the sum of its distances from the foci <= 2*r2. Due to the symmetry in the given case, and its dimensions all being even numbers, one quadrant at each level would need to be considered, then multiplied by 4.
FOR h = 1 TO 14
r1 = 3 * (1 - h / 14)
r2 = 5 * (1 - h / 14)
f = SQR(r2 ^ 2 - r1 ^ 2)
dsum0 = 2 * r2
FOR x = 1 TO 5
FOR y = 1 TO 3
d1 = SQR((x - f) ^ 2 + y ^ 2)
d2 = SQR((x + f) ^ 2 + y ^ 2)
IF d1 + d2 <= dsum0 THEN
ct = ct + 1
IF ABS(d1 + d2 - dsum0) < .000001 THEN
IF d1 + d2 > dsum0 THEN
counts 27 valid farthest-from-origin points above one quadrant of the elliptical base. No "warnings" were signalled, so there aren't borderline cases to worry about, concerning rounding errors.
Multiplied by 4, that's 108 cubes fitting entirely within the cone.
Broken down by level, the 108 are:
Posted by Charlie
on 2010-07-27 20:13:14