How to 3D plot a cube and a pyramid in appdesigner
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    mikel lasa
 le 9 Jan 2022
  
    
    
    
    
    Modifié(e) : Walter Roberson
      
      
 le 9 Jan 2022
            Hello,
I want to 3D plot a cube and a pyramid on a certain way in my app but I not able to do that. Until now, Ive plotted a sphere and a cylinder with surf but the following 2 are impossible for me
cube: I want to plot a cube using width, height and depth (sure is a silly thing but I didnt found anything in the forum)
pyramid: 3d plot it using the 4 vertex points.
I dont know if it is possible using surf. 
Thanks in advance!
0 commentaires
Réponse acceptée
  Walter Roberson
      
      
 le 9 Jan 2022
        
      Modifié(e) : Walter Roberson
      
      
 le 9 Jan 2022
  
      %use a regular figure only for online demonstration
if isunix()
    app.fig = figure();
else
    app.fig = uifigure();
end
app.UIAxes1 = axes(app.fig);
xvox = 2; yvox = 2; zvox = 2;   %data units in each dimension
rF = [1 2 3 4 1; 8 7 6 5 8; 1 4 6 7 1; 2 8 5 3 2; 1 7 8 2 1; 3 5 6 4 3];  %in closed form
rV = [0 0 0; 1 0 0; 1 0 1; 0 0 1; 1 1 1; 0 1 1; 0 1 0; 1 1 0] .* [xvox, yvox, zvox];
patch('Parent', app.UIAxes1, 'Faces', rF, 'Vertices', rV, 'FaceColor', 'b', 'FaceAlpha', 0.5);
view(app.UIAxes1, 3);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Environment and Settings dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


