필터 지우기
필터 지우기

dynamic capsule list color

조회 수: 1 (최근 30일)
Alexander Maier
Alexander Maier 2021년 3월 24일
댓글: Alexander Maier 2021년 3월 28일
Hello,
I have a Program, which iterates multiple objects an n amount of steps into the future. For this I use the dynamic capsule list.
Finally there is a visualisation of the capsules with
show(capList, 'TimeStep',1:capList.MaxNumSteps,'FastUpdate',1, 'ShowCollision', true);
drawnow;
For visual purposes I would like the capsules to be displayed in different colors and maybe add some additional capsules in a certain color. How could I manually set the color in this case? Thank you in advance!

채택된 답변

Adam Danz
Adam Danz 2021년 3월 24일
I'm not familiar with dynamicCapsuleList objects at all but played around with it a bit. The object colors are defined by patch objects burried in a series of hggroups and hgtransforms. The patch colors are in the CData or FaceColor properties of the patch objects.
I don't know whether the color can be specified as input properties but here's how to change color after the objects are rendered.
Get handles to all ObstacleListEgoGroups
OLEG = findobj(gca, 'Tag','ObstacleListEgoGroup');
Get handles to the patches within the group
ph = findobj(OLEG, 'Type', "Patch");
Set the color of the first patch obj to red
ph(1).FaceColor = 'r';
To set a transition of colors set FaceColor to 'flat' and define the CData values (see patch documentation).
  댓글 수: 1
Alexander Maier
Alexander Maier 2021년 3월 28일
Thanks, your help is much appreciated!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by