restart; #Caution, unpredictable results if executed out of order dprod := (a,b) -> sum(a[jjj]*b[jjj],jjj=1..nops(a)): cprod := (a,b) -> [a[2]*b[3]-a[3]*b[2], a[3]*b[1] - a[1]*b[3], a[1]*b[2] - a[2]*b[1] ]: #Cylinder V := expand([1,1,1]/sqrt(3)); U := expand([-1,1,0]/sqrt(2)); W := expand(cprod(U,V)); S := expand(cos(t)*U + sin(t)*W + s*V); plot3d(S,t=0..2*Pi,s=0..2,axes=boxed,grid=[40,3]); #Surface of revolution about x-axis g := [ t^2, sin(15*t) + 3]; S := [ g[1], g[2]*cos(s), g[2]*sin(s) ]; plot3d(S,t=0..2,s=0..2*Pi,axes=normal,grid=[150,20],style=patchnogrid,color=blue); #Sphere S := [cos(phi)*cos(theta),cos(phi)*sin(theta),sin(phi)]; plot3d(S,theta=0..2*Pi,phi=-Pi/2...Pi/2,axes=boxed); #Rational quadratic parametrization of a sphere S := [ 2*t/(1+s^2+t^2), 2*s/(1+s^2+t^2), (s^2+t^2-1)/(s^2+t^2+1) ]; plot3d(S,t=-.5..0.5,s=-.5..0.5,grid=[50,50]); #Torus T := [ (R + r*cos(t))*cos(theta) , (R+ r*cos(t))*sin(theta), r*sin(t) ]; R := 3; r := 4; plot3d(T,t=0..2*Pi,theta=0..2*Pi,scaling=constrained,color=blue,style=wireframe); #Bilinear patch P00 := [0,0,0]; P10:= [1,0,0]; P01 := [0,1,0] ; P11 := [1,1,1]; B := expand((1-s)*((1-t)*P00 + t*P10) + s*((1-t)*P01+t*P11)); plot3d(B,t=0..1,s=0..1,grid=[12,12]); #Hyperboloid phi := Pi/2; a1 := [cos(t),sin(t),0]; a2 := [cos(t+phi),sin(t+phi),1]; S := expand((1-s)*a1 + s*a2); plot3d(S,t=0..2*Pi,s=0..1); #Double helix b1 := [cos(t),sin(t),t]; b2 := [cos(t+Pi),sin(t+Pi),t]; S := expand((1-s)*b1+s*b2); plot3d(S,t=0..2*Pi, s=0..1); #Translational Surface p := [4*cos(t),4*sin(t),4*t]; q := [s,sin(3*s),0]; S := expand(p+q); plot3d(S,t=0..2*Pi,s=0..2*Pi);