Filter löschen
Filter löschen

dynamic capsule list color

1 Ansicht (letzte 30 Tage)
Alexander Maier
Alexander Maier am 24 Mär. 2021
Kommentiert: Alexander Maier am 28 Mär. 2021
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!

Akzeptierte Antwort

Adam Danz
Adam Danz am 24 Mär. 2021
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 Kommentar
Alexander Maier
Alexander Maier am 28 Mär. 2021
Thanks, your help is much appreciated!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by