Spatial Curve

Example from the PscFunctions package

With the help of procedures of the PSCFunctions  package it is possible to create parametric equations of the composite spatial curves.  They can be used for modelling the motion of machining tools for  numerical control machines.
In this example
CPolyline  routine creates the equation of a curve fragment. The CPolarPeriodic  routine generates a polar periodic continuation of the fragment. The generated formulas are used as equation of section of a cylindrical part. Adding displacement along  z-axis we obtain the equation of a helix.

>    with(PscFunctions):
cr:=CPolyline([[0,1],[1,2],[2,1],[1,0]]):
G:=CPolarPeriodic([cr],[0,3],angle=Pi/2):
plots[spacecurve]([G(t),t/16],t=0..192,axes=BOXED,color=BLACK,thickness=2,numpoints=2000,orientation=[15,60]);

[Maple Plot]

>    'X'=G[1](t);
'Y'=G[2](t);

X = cos(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-2)+1/2*abs(Mod(t,3)-3))+sin(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-1)+1/2*abs(Mod(t,3)-3))
X = cos(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-2)+1/2*abs(Mod(t,3)-3))+sin(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-1)+1/2*abs(Mod(t,3)-3))

Y = -sin(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-2)+1/2*abs(Mod(t,3)-3))+cos(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-1)+1/2*abs(Mod(t,3)-3))
Y = -sin(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-2)+1/2*abs(Mod(t,3)-3))+cos(1/2*Pi*floor(1/3*t))*(1/2+1/2*abs(Mod(t,3))-abs(Mod(t,3)-1)+1/2*abs(Mod(t,3)-3))

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