![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178842/image.jpeg)
Combining different mesh granularities
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
This code
figure;
[x, y, z] = sphere(20);
surf(x, y, z, 'edgecolor', 'None'); hold on;
surf(x, y, z, 'facecolor', 'None');
produces the plot
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168701/image.jpeg)
Instead, if I use a different granularity for the faces and the edges:
figure;
[x, y, z] = sphere(100);
[x1, y1, z1] = sphere;
s1 = surf(x, y, z, 'edgecolor', 'None'); hold on;
s2 = surf(x1, y1, z1, 'facecolor', 'None');
the edges are not complete:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168702/image.jpeg)
Does s1 interfere with s2 and how to fix the problem?
0 comentarios
Respuestas (1)
John D'Errico
el 24 de Oct. de 2017
This is more a question of understanding graphics. Of understanding what you are doing.
You need to consider that your monitor has limited resolution. It can only display so much information.
You created a pair of polyhedra. NO spheres were created. Only approximations to a sphere. Had they both been true spheres of the same radius, you could not see the difference at all.
Since one of the objects is a coarser approximation, but both with planar faces, it will be almost entirely inside the finer one. Since both are opaque, you will essentially NEVER see the coarser one at all, except where a vertex of the coarse polyhedron happens to stick out. When that happens, there will be some confusion.
t1 = linspace(0,2*pi,5);
t2 = linspace(0,2*pi,12);
r = 1;
plot(r*cos(t1),r*sin(t1),'b-',r*cos(t2),r*sin(t2),'r-')
axis equal
axis square
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178842/image.jpeg)
Where the blue circular approximation sticks out through the red one, there will clearly be confusion. But otherwise, you would never see the coarse one at all.
One solution is to use transparency. Hint, try setting 'facealpha',0.75.
0 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!