A pillar 2m tall stands on a square base, 20cm on a side. The peculiar thing about this pillar is that its top, which is parallel to the base, is an equilateral triangle 16cm on a side.
The four edges running the length of the pillar are linear. Two of these edges meet at one corner of the triangle, and the edge of the triangle opposite this vertex is parallel to two edges of the square. All horizontal cross sections have straight edges.
If the pillar is made of basalt (density = 2.8 g/cm^3), what is its total mass?
The puzzle states that the edge of the triangle opposite the vertex that has two of the nonhorizontal edges, is parallel to two edges of the square but does not actually state which two. In my previous solution I had assumed that the north vertex of the triangle connected to both ends of the north side of the square and the south side of the triangle was parallel to the north and south edges of the square. But if the top is twisted 90 degrees, say ccw as seen from above, what is now the west vertex is now still connected to the two ends of the north side of the square and the opposite edge of the triangle is parallel to the east and west sides of the square (i.e., running northsouth). The twist is not severe enough to entangle the edges, as it would in a 180degree twist, and so a column is still formed.
I'd hate to have to formulate this for integration, so I chose to integrate this numerically.
Each level except the top and the bottom is an irregular quadrilateral. Near the triangular top it in fact becomes nonconvex. The best way to get the area of the quadrilateral is to split it into two triangles, each of whose areas can be found using Heron's formula. In doing so it is important that the diagonal dividing the quadrilateral connect the concave vertex to its opposite (when such concave vertex exists), as if the other two vertices are connected, area outside the bounds of the actual quadrilateral would be included.
Heron's formula states that the area of a triangle equals √(s(sa)(sb)(sc)) where a, b and c are the lengths of the sides of the triangle, and s = (a+b+c)/2. This avoids the necessity of finding a base and altitude.
By setting coordinates for the vertices for the base and the top of the column, intermediate coordinates can be interpolated.
The following program evaluates the volume for both the nontwist and twist cases:
DEFDBL AZ
DIM topx(4), topy(4)
DIM botx(4), boty(4)
botx(1) = 0: boty(1) = 0
botx(2) = 20: boty(2) = 0
botx(3) = 20: boty(3) = 20
botx(4) = 0: boty(4) = 20
pi = ATN(1) * 4
dr = pi / 180
CLS
FOR twist = 0 TO 90 STEP 90
PRINT twist,
topx(1) = 0: topy(1) = 0
topx(2) = 16: topy(2) = 0
topx(3) = 8: topy(3) = 8 * SQR(3)
topx(4) = 8: topy(4) = 8 * SQR(3)
FOR i = 1 TO 4
x = topx(i) * COS(twist * dr)  topy(i) * SIN(twist * dr)
y = topx(i) * SIN(twist * dr) + topy(i) * COS(twist * dr)
topx(i) = x: topy(i) = y
NEXT
volume = 0
stepSize = .00001
FOR i = stepSize / 2 TO 1  stepSize / 2 STEP stepSize
' PRINT USING "#.## "; i;
FOR j = 1 TO 4
midx(j) = botx(j) * (1  i) + topx(j) * i
midy(j) = boty(j) * (1  i) + topy(j) * i
' PRINT USING "###.### ###.###; "; midx(j); midy(j);
NEXT
'Triangle Area=SQRT(s(sa)(sb)(sc)),
'where s = (a + b + c) / 2 OR perimeter / 2!
FOR j = 1 TO 4
k = (j MOD 4) + 1
dist(j) = SQR((midx(k)  midx(j)) ^ 2 + (midy(k)  midy(j)) ^ 2)
NEXT
dist(5) = SQR((midx(1)  midx(3)) ^ 2 + (midy(1)  midy(3)) ^ 2)
s = (dist(1) + dist(2) + dist(5)) / 2
area = SQR(s * (s  dist(1)) * (s  dist(2)) * (s  dist(5)))
s = (dist(4) + dist(3) + dist(5)) / 2
area = area + SQR(s * (s  dist(4)) * (s  dist(3)) * (s  dist(5)))
' PRINT USING "###.##"; area
volume = volume + area * stepSize * 200
NEXT i
PRINT volume
PRINT
NEXT twist
For the zero and 90degree twists the program finds the volumes:
0 48627.6871924711
90 34056.7495513749
So for the twisted case, 34057*2.8 = 95360 g, or, with allowed precision 95 kg.

Posted by Charlie
on 20030415 05:02:49 