필터 지우기
필터 지우기

combine surfaces into one big surface

조회 수: 27 (최근 30일)
Wesley Ooms
Wesley Ooms 2013년 6월 28일
답변: Ted Shultz 2020년 6월 3일
Hi,
I have a lot of surfaces and patches in a single plot; surf(this) surf(that). 376 in total. (I also have a struct with 376 handles to all surfaces/patches). Each patch on its own is pretty small, but every call to patch seems to be a call to the graphics renderer. To speed up the display updating, i would like to combine all surfaces, or patches, into one big surface. Is there an easy way to do this? All surfaces have the same color and all surfaces are stationary relative to each other. I was thinking about something like get all the handles and combine them into one handle somehow with al the vertexdata/facedata combined.

채택된 답변

Matt J
Matt J 2013년 6월 28일
편집: Matt J 2013년 6월 28일
but every call to patch seems to be a call to the graphics renderer.
You could try generating handles to the surf/patch objects without rendering them, by calling
h(i) = patch(...,'Visible','off');
and similarly for surf. Once you've generated a vector of handles this way, and you're ready to display, you can make the entire plot visible by doing
set(h,'Visible','on')
  댓글 수: 1
Faez Alkadi
Faez Alkadi 2017년 10월 26일
편집: Faez Alkadi 2017년 10월 26일
Is there a way to create a fv that is the merging results of all 376 parts and patch them as one surface?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ted Shultz
Ted Shultz 2020년 6월 3일
How I do this is I convert all the patch objects to polyshape objects, and then union the poly shape objects together. you can then convert the master polyshape back into a patch, or you can just display the polyshape. sample code for two shapes is shown below. If the patch objects are more complex shapes (multiple shapes per patch), then you sometimes need to do some additional tricks, but this is a start of what the code could look like.
p1=polyshape(h1.XData, h1.YData);
p2=polyshape(h2.XData, h2.YData);
polyout = union(p1,p2);
hOut = patch(polyout.Vertices(:,1),polyout.Vertices(:,2),'k','facecolor','none');
hOut.FaceColor = h1.FaceColor;
hOut.FaceAlpha = h1.FaceAlpha;
hOut.EdgeColor = h1.EdgeColor;
hOut.LineStyle = h1.LineStyle;
hOut.LineWidth = h1.LineWidth;
delete(h1)
delete(h2)

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by