kill(all)$

maxima :projection of triangles 3D to 2D  & paraboloid (version 1.0)
peter.vlasschaert@gmail.com, 25/04/2020

ref:https://petervlaschemeng.weebly.com/
================================
----------------------------------------------------------------------------------------------------------------------------
=> wxdraw3d & wxplot3d
new: 20/04/2021:maxima :  combination parametric plot 3d,version 1.0
download  (Maxima,code)       :maximaparametricplot3danddrawuse2021version1final
download  (Maxima,png)        :maximaparametricplot3danddrawuse2021version1finaloutp
new: 20/04/2021:maxima : combination parametric draw3d,version 1.0
download  (Maxima,code)       :maximaparametricdraw3final
download  (Maxima,png)        :maximaparametricdraw3finaloutp
-----------------------------------------------------------------------------------------------------------------------------

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

f(xx,yy):=block([],
zz:xx^2+yy^2,
return (zz)    
)$

2e) step :coordinates triangle xy plane.
-------------------------------------------------------
need :three points

point (x1,y1)

x1:1;
y1:1;

point (x2,y2)

x2:3;
y2:1;

point (x3,y3)

x3:3;
y3:4;

3e) step : projection 3D triangle ᐋᐆ 2D triangle
-----------------------------------------------------------------

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

→ point list

s:[[x1,y1,f(x1,y1)],[x2,y2,f(x2,y2)],
             [x3,y3,f(x3,y3)]];

→ maximum of z

s1:lmax(makelist(s[i][3],i,1,3));

rem :lmin(z)

wxdraw3d(
        title="projection 3D ᐎ to 2D ᐑ (triangle) ",
        line_width = 2,
        xyplane = 0,
        color = red,
        xlabel="x",
        ylabel="y", 
        zlabel="z",
        grid = true,        
        xrange =[-4,4],
        yrange =[-4,4],
        zrange =[0,s1+5],
        key = "3D trianle",
        mesh([[x1,y1,f(x1,y1)],[x2,y2,f(x2,y2)]],
             [[x3,y3,f(x3,y3)],[x3,y3,f(x3,y3)]]),
        line_width =4,
        color = blue,
        key = "2D triangle",
        mesh([[x1,y1,0],[x2,y2,0]],
             [[x3,y3,0],[x3,y3,0]]),
       color = green,
       key = "projection 3D ᐎ to 2D ᐑ ",
       points_joined = impulses,
       points(s)           
  ) $

4e) step : projection 3D→2D,paraboloid
---------------------------------------------------------

xa:4;/*max , x values */
ya:4;/*max , y values */

wxdraw3d(
        title="projection 3D(x,y,z) ᐎ to 2D(x,y) ᐑ (triangle) ",
        line_width = 2,
        xyplane = 0,
        color = red,
        xlabel="x",
        ylabel="y", 
        zlabel="z",
        grid = true,        
        xrange =[-xa,xa],
        yrange =[-xa,xa],
        zrange =[0,5*s1],
        key = "3D trianle",
        mesh([[x1,y1,f(x1,y1)],[x2,y2,f(x2,y2)]],
             [[x3,y3,f(x3,y3)],[x3,y3,f(x3,y3)]]),
        line_width =4,
        color = blue,
        key = "2D triangle",
        mesh([[x1,y1,0],[x2,y2,0]],
             [[x3,y3,0],[x3,y3,0]]),
       color = green,
       key = "projection 3D ᐎ to 2D ᐑ ",
       points_joined = impulses,
       points(s),
       color = "black",
       /* draw z-axis */
       line_width =2,
       points([[0,0,s1+10]]),
       color = "#521236",
       key = "paraboloid: z=x^2+y^2",
       line_width =0.2,
       explicit(f(x,y),x,-4,4,y,-4,4), 
       color = "black",
       line_width =2,
       key = "x-axis,pos",
       /* draw x-axis */
       /*-------------*/
       /* pos*/
       mesh([[0,0,0],[xa,0,0]],
             [[xa,0,0],[xa,0,0]]),
       key = "x-axis,neg",
       /* neg*/
       mesh([[0,0,0],[-xa,0,0]],
             [[-xa,0,0],[-xa,0,0]]),
       key = "y-axis,pos",
      /* draw y-axis */
      /*-------------*/
      /* pos*/
       mesh([[0,0,0],[0,ya,0]],
             [[0,ya,0],[0,ya,0]]),
       key = "y-axis,neg",
      /* neg*/
       mesh([[0,0,0],[0,-ya,0]],
             [[0,-ya,0],[0,-ya,0]]) 
  ) $

-----------------------------------------------------------------------------------------------------------------------------------