3D M Letter
Example from the PscFunctions package
Combining routines of the PscFunctions package it is possible to obtain equations of polysurfaces
.
In this example we shall show how it is possible to find the equation of the surface in the shape of three-dimensional M letter. For that it will be necessary the equation of the plane region in the shape of M letter. At the beginning we generate a parametric equation of the polygonal lines bounding region of the M letter from above and from below
> | restart; with(PscFunctions): xd:=FPolyline([[0,0],[1,1],[2,1],[3,2],[4,3],[5,3],[6,4]]): yd:=FPolyline([[0,0],[1,0],[2,2],[3,1],[4,2],[5,0],[6,0]]): yu:=FPolyline([[0,3],[1,3],[2,3],[3,2],[4,3],[5,3],[6,3]]): plot({[xd(t),yd(t),t=0..6],[xd(t),yu(t),t=-1..7]},-1..5,-1..4,thickness=3,scaling=CONSTRAINED,color=[BLACK,BLUE]); |
Then with the help of DPscRing routine we generate the equation of the plane region in the shape of M letter.
> | Mletter:=DPscRing([xd,yd],[xd,yu]): Mletter(u,v): plot3d([Mletter(u,v),0],u=0..6,v=0..1,axes=BOXED,grid=[11,11],scaling=CONSTRAINED,orientation=[-90,0],grid=[31,8]); |
Now we generate three continuous piecewise linear functions.
> | p1:=FPolyline([[-1,1],[0,0],[6,0],[7,1]]): p2:=FPolyline([[-1,1],[0,0],[1,0],[2,1]]): p:=FPolyline([[0,0],[1,1]]): print('p1'=p1(x)); print('p2'=p2(x)); print('p'=p(x)); plot([p1(x),p2(x)+0.08,p(x)],x=-2..8,thickness=3,color=[RED,BLUE,BLACK]); |
Here we have uplifted one graph that it did not merge with the others.
Then with the help of these functions we shall create the following function of two variables.
> | P2:=(u,v)->p(p1(u)+p2(v)): print('P2'=P2(u,v)); plot3d(P2(u,v),u=-3..9,v=-2..3,axes=BOXED,grid=[37,21]); |
Now we create a surface. Its x and y coordinates coincide with functions representing the equation of the plane region in the shape of M letter and its z coordinate is equal to the previous function P2(u,v) .
> | plot3d([Mletter(u,v),P2(u,v)],u=-1..7,v=-1..2,axes=BOXED,scaling=CONSTRAINED,orientation=[-115,60],grid=[41,16]); |
The obtained surface has no head. To add it the parametric equation of the other plane region will be necessary. Let's generate the upper and lower boundary curves.
> | fd3:=CPolyline([[0,6],[1,6],[1,4],[2,4],[3,4],[3,6],[4,6]],[0,1,2,3,4,5,6]): fu3:=CPolyline([[0,3],[1,3],[1,3],[2,3],[3,3],[3,3],[4,3]],[0,1,2,3,4,5,6]): print('xd'=fd3[1](t)); print('yd'=fd3[2](t)); print('xu'=fu3[1](t)); print('yu'=fu3[2](t)); plot({[fd3(t),t=-1..7],[fu3(t),t=-1..7]},-1..5,-1..6.1,thickness=2,scaling=CONSTRAINED); |
Then we generate the equation of the plane region bounded by these curves.
> | Cover:=DPscRing([fd3],[fu3],param2=3..2): plot3d([Cover(u,v),0],u=0..6,v=2..3,axes=BOXED,grid=[11,11],scaling=CONSTRAINED,orientation=[-90,0],grid=[31,8]); |
And then we create the equation of the surface as follows
> | x:=(u,v)->Mletter[1](u,v): y:=(u,v)->Mletter[2](u,v)-Cover[2](u,v)+3: z:=(u,v)->P2(u,v): plot3d([x(u,v),y(u,v),z(u,v)],u=-1..7,v=-1..3,axes=BOXED,scaling=CONSTRAINED,orientation=[-115,60],grid=[41,21]); |
Here is how the equation of the surface looks.
> | print('x'=x(u,v)); print('y'=y(u,v)); print('z'=z(u,v)); |