kill(all)$

maxima,packages draw 3d, intro : version 1.0
peter.vlasschaert@gmail.com,02/12/2020

ref:http://www.scotchildress.com/wxmaxima/3DPlotting/3dplotting.html

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

load(lrats)$ ratprint:false$ load(draw)$

→ Draw mesh( = evalationgrid  ) ,values( =random matrix)

1e) step :data ( M= matrix ),with random  values

m1:makelist(makelist(random(10.0),i,1,10),j,1,5);

M:apply(matrix,m1);

2e)  wxdraw3d 

r1:wxdraw3d(color=blue,
    xlabel = "x",ylabel = "y",
    surface_hide = true,
    mesh(M,0,0,10,5)
);

→ corrected 

r2:wxdraw3d(color=blue,
    title = "Draw matrix : 3d",
    xlabel = "x",ylabel = "y",zlabel="z",
    surface_hide = true,
    enhanced3d = true,
    elevation_grid(M,0,0,10,5))$

HOW draw 3D POINTS,LINES 
++++++++++++++++++++++++

→ use :1D  array ( start = 0,index,for array)

d1:make_array(fixnum,10);/* show connection between lisp & maxima */

rem : d1:index → 0 to 9 

x:make_array(fixnum,10)$
y:make_array(fixnum,10)$
z:make_array(fixnum,10)$

for i:0 thru 10-1 do(
x[i]:random(10),
y[i]:random(10),
z[i]:random(10) 
                    )$  
wxdraw3d(points(x,y,z),point_size=10,point_type = 4,
xlabel = "x",ylabel = "y",zlabel="z"    
)$

wxdraw3d(points_joined=true,point_size=3,point_type = 4,
         points(x,y,z),
         xlabel = "x",ylabel = "y",zlabel="z"    
        )$

→ use :2D  array ( start = (0,0),index,for array)

xyz:make_array(fixnum,10,3);

rem :index (0 to 9,0 to 2)

for i:0 thru 10-1 do(
xyz[i,0]:random(10),
xyz[i,1]:random(10),
xyz[i,2]:random(10)    
)$

xyplane;

wxdraw3d(points_joined=true,color=red,line_width=3,
xlabel = "x",ylabel = "y",zlabel="z",
title = "connect 3d points",
xtics = 0.5,ytics = 0.5,ztics = 1, grid=true,               
points(xyz)     
);

wxdraw3d(points_joined=true,color=green,line_width=5,
         axis_3d = false, zaxis =true,zaxis_type = solid,        
         zaxis_width=4,title = "connect 3d points",        
         points(xyz)     
);

→  draw in 3d  : with draw → function 

wxdraw(columns=2,
     gr3d(color=red,explicit(exp(-x1-y1),x1,-2,2,y1,-3,3)),
     gr3d(grid=true,explicit(exp(-x1^2-y1^2),x1,-2,2,y1,-3,3)) 
      );

→  draw in 3d  : with draw3d → function 

wxdraw3d(axis_3d=true,enhanced3d=true,
     xlabel = "x",ylabel = "y",zlabel="z",
     explicit(exp(-x1-y1),x1,-2,2,y1,-3,3),
     explicit(exp(-x1^2-y1^2),x1,-2,2,y1,-3,3),
     color = red, /*no impact in the code */
     points_joined=true,
     points(xyz),grid=true 
      );

wxdraw3d(axis_3d=false,enhanced3d=true,colorbox=false,
     implicit(-x1-y1-z1=0,x1,-2,2,y1,-3,3,z1,-2,2),     
     implicit(x1^2+y1^2+z1^2=3,x1,-2,2,y1,-3,3,z1,-2,2),
     enhanced3d = false,
     color = blue, 
     points(xyz), points_joined=true
     
      );

see:above graph with only objects

wxdraw(gr3d(explicit(exp(-x1-y1),x1,-2,2,y1,-3,3),grid=true
    ));

wxdraw3d(color=green,explicit(exp(-x1-y1),x1,-2,2,y1,-3,3),
         grid=true);

rem: default,example :
ref:http://www.scotchildress.com/wxmaxima/3DPlotting/3dplotting.html

 set_draw_defaults(
   axis_3d=false,
   proportional_axes=xy,
   surface_hide=true,
   enhanced3d=true,
   colorbox=false,
   xaxis=true,yaxis=true,zaxis=true,
   xaxis_type=solid,yaxis_type=solid,zaxis_type=solid,
   xaxis_width=2,yaxis_width=2,zaxis_width=2,
   zaxis_color=red,
   xlabel="y",ylabel="x",zlabel="",
   xyplane=0,
   xtics=false,ytics=false,ztics=false,
   view=[60,105]   
)$ 

 wxdraw3d(
   title="z=x^2+y^2",
   explicit(x1^2+y1^2,x1,-2,2,y1,-2,2)
   ); 