Combining different mesh granularities
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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:
Does s1 interfere with s2 and how to fix the problem?
댓글 수: 0
답변 (1개)
John D'Errico
2017년 10월 24일
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
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!