A Gear

Example from the PscFunctions package

Using routines of the PscFunctions package users can generate in an analytical form general parametric equations of surfaces of machine parts, containers, deformed solids and many other objects .
Here with the help of the
CPolyline , CPolarPeriodic  and SPolarPscExtrude   routines of the package we generate the parametric equation of a gear.
At the beginning we generate the equation of a polyline segment, which will compose a periodic foundation of the future curve. For this purpose we use the
CPolyline  routine.

>    restart;
with(PscFunctions):
alf:=Pi/24: dlt:=1/8:
x0:=1: x1:=cos(alf): x2:=(1-dlt)*cos(alf):
x3:=(1-dlt)*cos(2*alf): x4:=cos(2*alf):
y0:=0: y1:=sin(alf): y2:=(1-dlt)*sin(alf):
y3:=(1-dlt)*sin(2*alf): y4:=sin(2*alf):
L:=CPolyline([[x0,y0],[x1,y1],[x2,y2],[x3,y3],[x4,y4]]):
plot([L(t),t=0..4],0..1,thickness=2,scaling=CONSTRAINED);

[Maple Plot]

CPolarPeriodic  routine generates a sequence of two functions that represents a parametric equation of a plane curve being a polar-periodic continuation of the given curvilinear segment . The curvilinear segment many times rotates at the angle around a pole so its starting point is attached to the ending point forming a continuous curve.
Now we generate a parametric equation of the curve using
CPolarPeriodic    routine of the package.

>    W:=CPolarPeriodic([L],[0,4],angle=Pi/12):
plot([W(t),t=0..96],thickness=2,scaling=CONSTRAINED,numpoints=481);

[Maple Plot]

The SPolarPscExtrude  routine generates a sequence of three functions x(u,v), y(u,v), z(u,v)  that represents a parametric equation of a closed surface. The surface is formed by extrusion of a piecewise smooth continuous curve in direction perpendicular to the plane.
Using generated above equation of the closed polyline it is possible to generate the equation of the gear surface.

>    extr:=SPolarPscExtrude([W],1/2,checkcont=false,checkpole=false,checkstar=false):
plot3d([extr(u,v)],u=0..96,v=0..5/2,axes=BOXED,grid=[97,6],scaling=CONSTRAINED);

[Maple Plot]

Here is obtained parametric equation of the surface of the gear.

>    'X3'=extr[1](u,v);
'Y3'=extr[2](u,v);
'Z3'=extr[3](u,v);

X3 = 3/16*(-abs(v)+abs(v-1)+abs(v-3/2)-abs(v-5/2))*(((-7/6*cos(1/12*Pi)+cos(1/24*Pi))*abs(Mod(u,4)-2)+(-7/6*cos(1/24*Pi)+cos(1/12*Pi))*abs(Mod(u,4)-3)+(3/2*cos(1/24*Pi)-4/3)*abs(Mod(u,4)-1)+1/6*cos(1/1...
X3 = 3/16*(-abs(v)+abs(v-1)+abs(v-3/2)-abs(v-5/2))*(((-7/6*cos(1/12*Pi)+cos(1/24*Pi))*abs(Mod(u,4)-2)+(-7/6*cos(1/24*Pi)+cos(1/12*Pi))*abs(Mod(u,4)-3)+(3/2*cos(1/24*Pi)-4/3)*abs(Mod(u,4)-1)+1/6*cos(1/1...
X3 = 3/16*(-abs(v)+abs(v-1)+abs(v-3/2)-abs(v-5/2))*(((-7/6*cos(1/12*Pi)+cos(1/24*Pi))*abs(Mod(u,4)-2)+(-7/6*cos(1/24*Pi)+cos(1/12*Pi))*abs(Mod(u,4)-3)+(3/2*cos(1/24*Pi)-4/3)*abs(Mod(u,4)-1)+1/6*cos(1/1...
X3 = 3/16*(-abs(v)+abs(v-1)+abs(v-3/2)-abs(v-5/2))*(((-7/6*cos(1/12*Pi)+cos(1/24*Pi))*abs(Mod(u,4)-2)+(-7/6*cos(1/24*Pi)+cos(1/12*Pi))*abs(Mod(u,4)-3)+(3/2*cos(1/24*Pi)-4/3)*abs(Mod(u,4)-1)+1/6*cos(1/1...
X3 = 3/16*(-abs(v)+abs(v-1)+abs(v-3/2)-abs(v-5/2))*(((-7/6*cos(1/12*Pi)+cos(1/24*Pi))*abs(Mod(u,4)-2)+(-7/6*cos(1/24*Pi)+cos(1/12*Pi))*abs(Mod(u,4)-3)+(3/2*cos(1/24*Pi)-4/3)*abs(Mod(u,4)-1)+1/6*cos(1/1...

Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...
Y3 = (1/2*abs(v)-1/2*abs(v-1)-1/2*abs(v-3/2)+1/2*abs(v-5/2))*(1/2*sin(1/12*Pi*floor(1/4*u))+1/2*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(u,4))-9/16*sin(1/12*Pi*floor(1/4*u))*cos(1/24*Pi)*abs(Mod(...

Z3 = 1/4+1/2*abs(v-1)-1/2*abs(v-3/2)

The function Mod(t,a)  used in the formulas gives the remainder on division of the first argument by the second