3D Rotation in UIAxes

8 views (last 30 days)
Felix Crevier
Felix Crevier on 8 Jan 2021
Answered: Srija Kethiri on 26 Oct 2022
Hello,
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 Comments
Mario Malic
Mario Malic on 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.
Felix Crevier
Felix Crevier on 8 Jan 2021
Edited: Felix Crevier on 8 Jan 2021
Yes, fingers crossed!
And, no, my graphics are actually very simple (a few patches with 4 vertices each)! They take a few milliseconds to render in figure. Anyways, thanks for your comments.

Sign in to comment.

Answers (1)

Srija Kethiri
Srija Kethiri on 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!

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!