Multistage Pyramid

Example from the PscFunctions package

With the help of routines of the package users can construct general parametric equation of a polyhedral or a piecewise linear surface.
In the first example we shall create a circular multistage pyramid. At first we create two continuous piecewise linear functions using
FPolyline  routine of the package.

>    restart;
with(PscFunctions):
f1:=FPolyline([[0,0],[1,1/3],[2,1/3],[3,2/3],[4,2/3],[5,1],[6,1],[7,0]]):
f2:=FPolyline([[1,0],[2,1/3],[3,1/3],[4,2/3],[5,2/3],[6,1]]):
plot([f1(x),f2(x)],x=-1..8,thickness=[2,3],color=[RED,BLACK],numpoints=1000);
print('f1'=f1(x));
print('f2'=f2(x));

[Maple Plot]

f1 = 1/6*abs(x)-1/6*abs(x-1)+1/6*abs(x-2)-1/6*abs(x-3)+1/6*abs(x-4)-1/6*abs(x-5)-1/2*abs(x-6)+1/2*abs(x-7)
f2 = 1/2+1/6*abs(x-1)-1/6*abs(x-2)+1/6*abs(x-3)-1/6*abs(x-4)+1/6*abs(x-5)-1/6*abs(x-6)

With the help of these functions we shall create three functions, which will represent parametric equation of the circular multistage pyramid with both bases.

>    R:=8: H:=15:
x:=(u,v)->R*cos(u)*f1(v):
y:=(u,v)->R*sin(u)*f1(v):
z:=(u,v)->f2(v)*H:
plot3d([x(u,v),y(u,v),z(u,v)],u=0..2*Pi,v=0..7,scaling=CONSTRAINED,grid=[31,29],orientation=[30,-60]);

[Maple Plot]

Let us look at the equation of the surface.

>    print('x'=x(u,v));
print('y'=y(u,v));
print('z'=z(u,v));

x = 8*cos(u)*(1/6*abs(v)-1/6*abs(v-1)+1/6*abs(v-2)-1/6*abs(v-3)+1/6*abs(v-4)-1/6*abs(v-5)-1/2*abs(v-6)+1/2*abs(v-7))
y = 8*sin(u)*(1/6*abs(v)-1/6*abs(v-1)+1/6*abs(v-2)-1/6*abs(v-3)+1/6*abs(v-4)-1/6*abs(v-5)-1/2*abs(v-6)+1/2*abs(v-7))
z = 15/2+5/2*abs(v-1)-5/2*abs(v-2)+5/2*abs(v-3)-5/2*abs(v-4)+5/2*abs(v-5)-5/2*abs(v-6)

In these expressions it is possible to replace the equation of the circle by the equation of any closed curve. Let's take, for example, the regular hexagon. The CRegularGon  routine generates parametric equation of polyline of a regular polygon. Here is its equation.

>    poly6:=CRegularGon(6,8):
plot([poly6(t),t=0..6],-10..10,-10..10,thickness=2,scaling=CONSTRAINED,numpoints=1000);
print('x'=poly6[1](t));
print('y'=poly6[2](t));

[Maple Plot]

x = 8-2*abs(t)-2*abs(t-1)+2*abs(t-2)+4*abs(t-3)+2*abs(t-4)-2*abs(t-5)-2*abs(t-6)
y = 2*3^(1/2)*abs(t)-2*3^(1/2)*abs(t-1)-2*3^(1/2)*abs(t-2)+2*3^(1/2)*abs(t-4)+2*3^(1/2)*abs(t-5)-2*3^(1/2)*abs(t-6)

Instead of factors R*cos(u) and R*sin(u) in the equation of the circular multistage pyramid we shall take the functions poly6[i]. As a result we get the equation of a hexagonal multistage pyramid.

>    x:=(u,v)->poly6[1](u)*f1(v):
y:=(u,v)->poly6[2](u)*f1(v):
z:=(u,v)->f2(v)*H:
plot3d([x(u,v),y(u,v),z(u,v)],u=0..6,v=0..7,scaling=CONSTRAINED,grid=[25,22],orientation=[-140,-125]);

[Maple Plot]

Here is its equation.

>    'x'=x(u,v);
'y'=y(u,v);
'z'=z(u,v);

x = (8-2*abs(u)-2*abs(u-1)+2*abs(u-2)+4*abs(u-3)+2*abs(u-4)-2*abs(u-5)-2*abs(u-6))*(1/6*abs(v)-1/6*abs(v-1)+1/6*abs(v-2)-1/6*abs(v-3)+1/6*abs(v-4)-1/6*abs(v-5)-1/2*abs(v-6)+1/2*abs(v-7))
x = (8-2*abs(u)-2*abs(u-1)+2*abs(u-2)+4*abs(u-3)+2*abs(u-4)-2*abs(u-5)-2*abs(u-6))*(1/6*abs(v)-1/6*abs(v-1)+1/6*abs(v-2)-1/6*abs(v-3)+1/6*abs(v-4)-1/6*abs(v-5)-1/2*abs(v-6)+1/2*abs(v-7))

y = (2*3^(1/2)*abs(u-4)+2*3^(1/2)*abs(u-5)-2*3^(1/2)*abs(u-6)+2*3^(1/2)*abs(u)-2*3^(1/2)*abs(u-1)-2*3^(1/2)*abs(u-2))*(1/6*abs(v)-1/6*abs(v-1)+1/6*abs(v-2)-1/6*abs(v-3)+1/6*abs(v-4)-1/6*abs(v-5)-1/2*ab...
y = (2*3^(1/2)*abs(u-4)+2*3^(1/2)*abs(u-5)-2*3^(1/2)*abs(u-6)+2*3^(1/2)*abs(u)-2*3^(1/2)*abs(u-1)-2*3^(1/2)*abs(u-2))*(1/6*abs(v)-1/6*abs(v-1)+1/6*abs(v-2)-1/6*abs(v-3)+1/6*abs(v-4)-1/6*abs(v-5)-1/2*ab...

z = 15/2+5/2*abs(v-1)-5/2*abs(v-2)+5/2*abs(v-3)-5/2*abs(v-4)+5/2*abs(v-5)-5/2*abs(v-6)