:

## Partitioning a cube into pyramids: An animation

Maple

Here is a little cute demo that shows how a cube may paritioned into three congruent pyramids.  This was inspired by a Mathematica demo that I found in the web but I think this one's better :-)

A Cube as a union of three right pyramids

Here is an animated demo of the well-known fact that a cube may be partitioned

into three congruent right pyramids.

2020-05-21

 > restart;
 > with(plots):
 > with(plottools):

A proc to plot a general polyhedron.
list of vertices
list of faces

An entry  in describes a face made of the vertices  etc.

 > polyhedron := proc(V::list, F::list)   seq(plottools:-polygon([seq( V[F[i][j]], j=1..nops(F[i]))]), i=1..nops(F));   plots:-display(%); end proc:

Define the vertices and faces of a pyramid:

 > v := [[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1]]; f := [ [1,2,3,4], [5,2,3], [5,3,4], [1,5,4], [1,2,5] ];

Build three such pyramids:

 > P1 := polyhedron(v, f): P2 := reflect(P1, [[1,0,0],[1,1,0],[1,0,1]]): P3 := reflect(P1, [[0,1,0],[1,1,0],[0,1,1]]):

This is what we have so far:

 > display(P1,P2,P3, scaling=constrained);

Define an animation frame.  The parameter  goes from 0 to 1.

Any extra options are assumed to be plot3d options and are

passed to plots:-display.

 > frame := proc(t)   plots:-display(     P1,     rotate(P2, Pi/2*t, [[1,1,0],[1,0,0]]),     rotate(P3, Pi/2*t, [[0,1,0],[1,1,0]]),     color=["Red", "Green", "Blue"], _rest); end proc:

Animate:

 > display(frame(0) \$40, seq(frame(t), t=0..1, 0.01), frame(1) \$40,   insequence, scaling=constrained, axes=none,   orientation=[45,0,120], viewpoint=circleleft);