3D Rotation in UIAxes
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
My question somewhat relates to the topics discussed in https://www.mathworks.com/matlabcentral/answers/367915-app-designer-3d-in-gui-rotate3d.
I have an app with two UIAxes showing very simple patches (less than 20 vertices), and I want to orbit around them programatically using "left" and "right" buttons, effectively changing the camera azimuth while maintaining a constant elevation. Using view(app.hUIaxes, [az, el]) or camorbit(...) is extremely slow, to the point of being unusable, and performance seems to decrease with total number of components in the app. However, if I use the 3D rotation tool of the Toolbar, I am able to rotate the axes smoothly and in realtime.
The overall behaviour seems to be identical when I manually create an Axes object at startup instead of the default palette UIAxes.
Is this a known flaw? Is there a workaround? What magic behind toolbar-manual-rotate3D makes it smoother than all other viewing functions on UIFigures?
All my thanks,
Felix
----
Version: Matlab 2020b update 3
8 commentaires
Mario Malic
le 8 Jan 2021
Considering that your graphic looks quite complicated, it'll probably take a second or even few to get a single frame, and you ask for 30 of them. If you're interested in animation only, maybe you could animate it in figure and play a video file in App Designer.
It has been like this for some time, but they have mentioned that it's going to be better, hopefully in the next release.
Réponses (1)
Srija Kethiri
le 26 Oct 2022
Hi Felix,
Based on your description
Question 1:
"The overall behaviour is identical when I manually create an Axes object at startup instead of the default palette UIAxes."
Starting in R2020b, as long as you are not saving the axes/uiaxes to a FIG file or loading an axes/uiaxes from a FIG file, there should be no difference in performance between “axes” and “uiaxes”. Switching between “axes” and “uiaxes” is unlikely to have any impact on performance.
Question 2:
"What magic behind toolbar-manual-rotate3D makes it smoother than all other viewing functions on UIFigures?"
What does make a significant difference is whether the figure is created using the "figure" command or created using the "uifigure" command.
- All App Designer apps use "uifigure", this cannot be changed (App Designer apps can call the figure command, but that will create a standalone figure).
- Figures created using the "uifigure" command are slower than figures created using the "figure" command. This is an area of active work to improve the performance of “uifgure”, so you can expect things to get better as new releases come out.
By default, the "uiaxes" command will create a “uifigure”, unless you specify a parent.
By default, the "axes" command will create a regular figure, unless you specify a parent.
The 3D rotation toolbar only exists in regular figures. The reason the toolbar rotate3D is faster is because it is in a regular figure.
Question 3:
You mentioned the issue getting worse with more objects.
You may want to investigate two modifications that could help:
1. If you are rotating the axes (which means that all the children need to be updated), you will generally get better performance with a single patch object that has multiple faces, rather than several patch objects with one face each.
2. You can also get better performance using an “hgtransform” and setting the Matrix property of the “hgtransform “to perform rotation, rather than rotating the entire axes.
Hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Develop uifigure-Based Apps 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!