PVS pyramid and prism

translate

\text{Translate pyramid}

\text{Sides}

The graphics view shows a regular pyramid on the left and a prism on the right. Both solids have congruent bases and heights. A slider controls the number of sides of the bases of both solids. Another slider allows to move the pyramid into the prism.

\text{Rotate view}

f: y = 3
segmC = Segment((-1.5, 3), (1.5, 3))
C = Point(segmC)
HM: (x(C), y(C), 4.5)
hPri = Segment(C + (0, 0, 0.1), HM)
n = 3 (slider from 3 to 8, step 1)
A: (0, 0)
T = Point(yAxis)
vert = Sequence(Rotate[C, ((t * 2) * pi / n), T], t, 1, n)
polyBase = Polygon(vert)
speed: 1
h = Ray(C + (0, 0, 0.1), (x(C), y(C), 40))
H = Point(hPri)
hei = Segment(C, H)
a, D, E, F, G, I, J, K, L, face1, face3, face4, face5, face6, face7, face2, face15, faceDEFGIJK, edge1, edge2, edge3, edge4, edge5, edge6, edge7, edge15, edgeDE, edgeEF, edgeFG, edgeGI, edgeIJ, edgeJK, edgeDK, edge16 = Prism(polyBase, hei)
u = Vector(A, T)
tra = -1 (slider from -1 to 0)
pyrBase = Translate(polyBase, Vector[(tra * u)])
b, B, face8, face10, face11, face12, face13, face14, face9, face16, edge8, edge9, edge10, edge11, edge12, edge13, edge14, edge17 = Pyramid(pyrBase, hei)
M = Centroid(pyrBase)
V: (x(M), y(M), z(H))
hPir = Segment(V, M)
v = Vector(C, H)
vertUp = Translate(vert, v)
vertPir_{1}, vertPir_{2}, vertPir_{3}, vertPir_{4}, vertPir_{5}, vertPir_{6}, vertPir_{7}, vertPir_{8} = Vertex(pyrBase)
N = (-5.345201702055899, 5.192820347958643)
O = (-6.307349360531144, 6.154968115396794)
textMain: "\text{Area of base: B = " + (LaTeX[polyBase]) + "\\\\
Height: h = " + (LaTeX[hei]) + "\\\\\\
\underline{Volumes}\\\\
\textcolor{#6557D2}{Pyramid \[=\frac{B \cdot h}{3}=" + (LaTeX[b]) + "\]}\\\\
\textcolor{#0F8538}{Prism \[=B\cdot h=" + (LaTeX[a]) + "\]}\\\\\\\\\\
\frac{\textcolor{#6557D2}{Volume of Pyramid}}{\textcolor{#0F8538}{Volume of Prism}}\[=\frac{1}{3}\approx \frac{" + (LaTeX[b]) + "}{" + (LaTeX[a]) + "}\]}"
textPyra: "\text{Volume of Pyramid \(=\dfrac{B \cdot h}{3}= " + (LaTeX[b]) + "\)}"
textTop: "\text{Area of base: \(B = " + (LaTeX[polyBase]) + "\) \\\\ Height: \(h =" + (LaTeX[hei]) + "\)}"
textPrism: "\text{Volume of Prism \(=B\cdot h=" + (LaTeX[a]) + " \)}"
textRatio: "\text{\frac{\textcolor{#6557D2}{Volume of Pyramid}}{\textcolor{#0F8538}{Volume of Prism}}\[=\frac{1}{3}\approx \frac{ " + (LaTeX[b]) + "}{ " + (LaTeX[a]) + "}\]}"
percDil: round((abs(x(C)) * 100 / 1.5), 0)
percHei: round(((z(H) - 0.1) * 100 / Length[hPri]), 0)
altCaptionSides: "\text{The base has " + (LaTeX[n]) + " sides.}"
fakeCursorGrid = Sequence((-8.6, 3.2) + (t / 6 * ((-4.1, 3.2) - (-8.6, 3.2))), t, 1, 6)
PSLI = Element(fakeCursorGrid, n - 2)
fakeSliVal: "" + (LaTeX[n]) + ""
percAni: 100 - round((abs(tra) * 100), 0)
bBlack, P, faccia1, faccia3, faccia2, face17, face18, face19, face20, face21, spigolo1, spigolo2, spigolo3, edge18, edge19, edge20, edge21, edge22 = Pyramid(pyrBase, hei)
priBlack, Q, R, S, U, W, Z, A_1, B_1, faccia4, faccia6, faccia5, face22, face23, face24, face25, face26, facciaQRS, spigolo4, spigolo5, spigolo6, edge23, edge24, edge25, edge26, edge27, spigoloQR, spigoloRS, spigoloQS, edge28, edge29, edge30, edge31, edge32 = Prism(polyBase, hei)
AppSize = Corner(5)
povSli = 1 (slider from 1 to 5, step 1)
tabOrder: {textTop, textPyra, textPrism, textRatio, n, tra, povSli, C, H}
altCaptC: "\text{Base area = \(" + (LaTeX[polyBase]) + "\). Range is at " + (LaTeX[percDil]) + "\%.}"
altCaptH: "\text{Height = \(" + (LaTeX[hei]) + "\). Range is at " + (LaTeX[percHei]) + "\%.}"
allViews: {Vector[(-90°; 10°; 30°)], Vector[(-1, 0, 0)], Vector[(0, 1, 0)], Vector[(0, 0, -1)], Vector[(-90°; 10°; 30°)]}
altView: "\text{" + (LaTeX[If[povSli ≟ 1, "Rotate view slider. ", ""]]) + "" + (LaTeX[If[povSli ≟ 2, "Side view 1: the pyramid appears as a triangle, and the prism as a rectangle. The two polygons have congruent bases and heights.", povSli ≟ 3, "Side view 2: the pyramid appears as a triangle, and the prism as a rectangle. The triangle is inside the rectangle, and the two polygons have congruent bases and heights.", povSli ≟ 4, "Top view: both solids are displayed as their congruent bases. The apex of the pyramid is at the center of the related polygon, and the segments connecting the apex with the vertices of the base are visible.", "Standard view: a pyramid and a prism with congruent bases and heights are displayed."]]) + "}"
altAnim: "\text{Translate pyramid slider is at " + (LaTeX[percAni]) + " \%. " + (LaTeX[If[0 < percAni < 100, "The pyramid is translated towards the prism.", percAni ≟ 100, "The pyramid is fully contained in the prism, and their bases coincide.", ""]]) + ""