Cube cut demo program

Program function

  • Draw cube
  • Calculate and draw a plane based on plane equations or three-point coordinates
  • Line segment where the plane normal vector passes through a fixed point
  • Separately generate cutaways
  • Start parameters
  • Start from PPT and full screen

Screenshot

Download link

[sdm_download id="1723" fancy="1"]

Start parameters

  • (a, b, c, d) = equation coefficient ABCD starts and automatically plots
  • ("FS") = Start full screen
  • (a, b, c, d, "FS") = The above combination

Click here to see how matlab is used in PPT

Part of the core code of Matlab

%Draw a plane based on points
cla(sp1)
cla(sp2)
clear Z
syms Z
A=[0 0 -5];
B=[-5 -3 -5];
C=[-5 4 5];
D=[ones(4,1),[[X,Y,Z];A;B;C]];
detd=det(D);
disp(detd);%Plane equation
cf=coeffs(detd,[X Y Z]);
a=double(cf(4));
b=double(cf(3));
c=double(cf(2));
d=double(cf(1));
Z(X,Y)=solve(detd,Z)
fsurf(sp1,Z,[-5 5 -5 5],'-','EdgeColor',"none",'FaceAlpha',.3)
fsurf(sp2,Z,[-5 5 -5 5],'-','FaceColor',[0.3010 0.7450 0.9330],'Edgecolor',[0.3010 0.7450 0.9330])Code language: Matlab (matlab)
 Unless otherwise stated, the articles are original.
 Title of this article:Cube cut demo program
 Hyperlink to this article:https://manwish.cn/en/article/cube-cut-demo-program.html

Leave a Comment