kill(all)$

maxima :combination parametric plot 3d,version 1.0
peter.vlasschaert@gmail.com,19/04/2021

load packages,option
=================

load(lrats)$ ratprint:false $

wxplot3d ( parametric)
=======

wxplot3d(u^2+v^2,[u,-5,5],[v,-5,5]);

wxplot3d([[2,2,1*u],[u,0,5],[v,-5,5]],[x, -4, 4], [y, -4, 4]);

draw vertical lines & parametric plot 
-------------------------------------------------

wxplot3d ([[u^2+v^2, [u, -2, 2], [v, -2, 2]],
   [2,2,3*u], [u, -3, 3], [v, -3, 3],[-2,-2,3*u], [u, -3, 3], [v, -3, 3]],
   [x, -4, 4], [y, -4, 4]);

draw vertical lines & draw vertical horizontal lines &  parametric plot 
--------------------------------------------------------------------------------------------

wxplot3d ([[u^2+v^2, [u, -2, 2], [v, -2, 2]],
   [-2+4*u,-2+4*u,0], [u, 0, 1], [v, -3, 3],[-2,-2,3*u], [u, -3, 3], [v, -3, 3]],
   [x, -4, 4], [y, -4, 4]);

u1:[u,v,u^2+v^2];          /*paraboloid z=x^2+y^2    */
u2:[-2+4*u,-2+4*u,0];/*horizointal line (z=0,(-2,-2)to(2,2))*/
u3:[-2,-2,3*u];      /*vertical line (-2,2)    */
u4:[2,2,3*u];        /*vertical line (2,2 )    */
u5:[-2+4*u,-2+4*v,-2];/*horizontal plane z=-1,blue */
u6:[-2+4*u,-2+4*v,7*u-3*v-10];/* green plane   */
u7:[-2+4*u,-2+4*v,7*u-3*v+10]; /* purple plane */

wxplot3d ( [u1, [u,-3,3], [v,-3,3],
            u2, [u,0,1 ], [v,-3,3],
            u3, [u,-3,3], [v,-3,3],
            u4, [u,-3,3], [v,-3,3],
            u5, [u,-3,3], [v,-3,3],
            u6, [u,-3,3], [v,-3,3],
            u7, [u,-3,3], [v,-3,3]
            ],
            [x, -4, 4], [y, -4, 4]);

rem:green plane (z=-10) // purple plane(z=10) 

draw (parametric)
====

rem : method draw vertical lines , not  good => load(draw), multiplie lines.

load :packages 
----------------------

load(draw)$

1e) step :draw paraboloid 
------------------------------------

type :explicit:

 wxdraw3d(explicit(x^2+y^2,x,-2,2,y,-2,2),xlabel="x",ylabel="y",
xyplane = -1); 

s1:"Paraboloid: z=x^2+y^2, Hyperbolic Paraboloid: z=x^2-y^2";

2e) step :draw paraboloid  & draw hyperbolic paraboloid
------------------------------------------------------------------------------
combination :plots

 wxdraw3d(title=s1,
    enhanced3d=true,
    view=[65,30],
    zrange=[0,10],
    proportional_axes=xy,    
    key="paraboloid",
    explicit(x^2+y^2,x,-3,3,y,-3,3),
    key="Hyperbolic Paraboloid",
    explicit(x^2-y^2,x,-3,3,y,-3,3),
    xlabel="x",
    ylabel="y"    
        ); 

s2:"parametric lines";m:makelist([random(1.0),random(1.0),random(1.0)],i,1,5);
 wxdraw3d(
         enhanced3d = [sin(j), j],
         point_size = 1,
         point_type = filled_circle,
         points_joined = true,
         points(m)) $

 wxdraw3d(
         title = s2,
         nticks = 60,
         line_width = 3,
         enhanced3d = (u-1)^2,
         xyplane =0,
         proportional_axes=xy,
         key = "horizointal line",
         parametric(4*u-2,4*u-2,0,u,0,1),
         key = "vertical line",
         parametric(2,2,3*u,u,0,1)
)$

for i:1 thru 2 do(
wxdraw3d(
         title = s2,
         nticks = 60,
         line_width = 3,
         enhanced3d = (u-1)^2,
         xyplane =0,
         proportional_axes=xy,
         key = "horizointal line",
         parametric(4*u-i,4*u-i,0,u,0,1),
         key = "vertical line",
         parametric(2,2,3*u,u,0,1)
        )
)$

rem : for loop can only be used outside draw3d not inside draw3d.

→ mutiple plots : makelist & points

m:makelist([random(1.0),random(1.0),random(1.0)],i,1,5);
 wxdraw3d(
         enhanced3d = [sin(j), j],
         point_size = 1,
         point_type = filled_circle,
         points_joined = true,
         points(m)) $

points(m);

→ vertical line

m1:makelist([2,2,3*i],i,1,5);
 wxdraw3d(
         enhanced3d = [sin(j), j],
         point_size = 1,
         point_type = filled_circle,
         points_joined = true,
         points(m1)) $

→ multiple vertical lines

m2:makelist(makelist([u,u,3*i],i,1,5),u,-2 ,2);
m2[1];
m2[2];

 wxdraw3d(
         enhanced3d = [sin(j), j],
         point_size = 1,
         point_type = filled_circle,
         points_joined = true,
         points(m2[1]),
         points(m2[2]),
         points(m2[3]),
         points(m2[4]),
         points(m2[5])
         
) $

rem : u,a,b  means  three vertical lines : assume a < b , a = -integer1 , b =+integer2
------------------------------------------------------------------------------------------------------------------
→  number vertical lines : u ,-2,2  → b-a+1 = 2-(-2)+1 = 5 =>  m2[i], i=1,2,3,4,5

combined : points & makelist
----------------------------------------

→ three column data 

 wxdraw3d(        
        key           = "joined points",
        points_joined = true,
        color = red,
        xyplane = 4,
        /* proportional_axes=xy,*/
        points(
        
        makelist(k,k,1,5),
        makelist(random(30),k,1,5),
        makelist(2*k,k,1,5)
        
              )         
        )$

rem : makelist inside draw 3d because you can't use 'for loop' .see : above

m4:[makelist(k,k,1,5),
        makelist(random(10),k,1,5),
        makelist(2*k,k,1,5)];

→ matrix data 

mx: apply(
          matrix,
          makelist(makelist(random(10.0),k,0,10),i,0,10))$

wxdraw3d(
         color = blue,
         grid = true,
         elevation_grid(mx,0,0,10,10),
         xlabel = "x",
         ylabel = "y",
         surface_hide = true);

pts:points(makelist(
[cos(t*%pi/10),sin(t*%pi/10),3*t],t,-20,20,0.01))$
wxdraw3d(title="helix",color=red,pts);

How draw3d : 3D triangle , 2D triangle
------------------------------------------------------

wxdraw3d(
        line_width = 2,
        xyplane = 0,
        color = red,
        xlabel="x",
        ylabel="y", 
        grid = true,
        xrange =[-1,1],
        yrange =[-1,1],
        key = "3D trianle",
        mesh([[1,0,0],[0,1,0]],
             [[0,0,1],[0,0,1]]),
        line_width =4,
        color = blue,
        key = "2D triangle",
        mesh([[1,0,0],[0,1,0]],
             [[0,0,0],[0,0,0]])        
  ) $

How draw3d : 3D line , 2D line
-----------------------------------------------------

ref :https://maxima-discuss.narkive.com/GNe70yGa/curve-alias-parametric-and-a-sphere-should-be-a-sphere

→ 3D line

line : [2,3,2]+t*[1,-2,-5]$
wxdraw3d( xyplane = 0,          
    apply(parametric,append(line,[t,-2,2])));

→ 2D line

line1 : [2,3,0]+t*[1,-2,0]$
     wxdraw3d( xyplane =0,
    apply(parametric,append(line1,[t,-2,2])));

Draws points in 2D and 3D.
--------------------------------------

Graphic object: points ([[x1, y1], [x2, y2], …])
Graphic object: points ([x1, x2, …], [y1, y2, …])
Graphic object: points ([y1, y2, …])
Graphic object: points ([[x1, y1, z1], [x2, y2, z2], …])
Graphic object: points ([x1, x2, …], [y1, y2, …], [z1, z2, …])
Graphic object: points (matrix)
Graphic object: points (1d_y_array)
Graphic object: points (1d_x_array, 1d_y_array)
Graphic object: points (1d_x_array, 1d_y_array, 1d_z_array)
Graphic object: points (2d_xy_array)
Graphic object: points (2d_xyz_array)