Effacer les filtres
Effacer les filtres

dynamic capsule list color

1 vue (au cours des 30 derniers jours)
Alexander Maier
Alexander Maier le 24 Mar 2021
Commenté : Alexander Maier le 28 Mar 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!

Réponse acceptée

Adam Danz
Adam Danz le 24 Mar 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 commentaire
Alexander Maier
Alexander Maier le 28 Mar 2021
Thanks, your help is much appreciated!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by