How to overlay a UIAxes surface on a UIFigure 3D image

4 次查看(过去 30 天)
I have two components, a UIFigure globe and a UIAxes hemisphere created with surf(). I want to overlay the surf object on the globe, but they are different type objects. The UIAxes object is a subset of the UIFigure, so they do not appear together. How can I resolve this?
Here is the UIFigure globe:
and here is the UIAxes hemisphere:
The relevant code looks like this:
.
.
.
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [0 0 1000 650];
% Create Image
img = world_globe(app.UIFigure);
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
app.UIAxes.Position = [0 0 1000 600];
app.UIAxes.XLim = [0 1100];
app.UIAxes.YLim = [0 580];
app.UIAxes.Visible = 'off';
app.UIFigure.Visible = 'on';
% App creation and deletion
methods (Access = public)
% Construct app
function app = globe_frame
% Create UIFigure and components
createComponents(app);
% Register the app with App Designer
registerApp(app, app.UIFigure)
globe = app;
color = [0.8 0.8 0.8]; % grey
obj = draw_hemisphere(globe,90,45,color);
end
%--------------------------------------------------------
function object = draw_hemisphere(globe,azLeft,azRight,color)
global xEarth; % Earth's orbital coordinates
global yEarth;
global zEarth;
global ERad; % Earth radius
dtor = .017453292;
az1r = azLeft * dtor;
az2r = azRight * dtor;
r = 1; % scale factor
theta=[az1r:0.01:az2r]*2*pi;
phi=[0:0.01:pi/4];
[THETA,PHI]=meshgrid(theta,phi);
x=r .* (cos(THETA).*sin(PHI));
y=r .* (sin(THETA).*sin(PHI));
z=r .* cos(PHI);
object = surf(globe.UIAxes, xEarth+x, yEarth+y, zEarth+z, 'FaceAlpha', 0.5, 'FaceColor', color, EdgeColor = 'none');
end
You can't draw this globe using UIAxes, and you can't use surf() on a UIFigure. How do I resolve this?
I have also looked at various other techniques, such as using geoplot. I have the Mapping Toolbox, but not Image Processing, so that is not an option.

回答(1 个)

Kurt
Kurt 2023-12-12
It appears you can't get there from here usining geo data. I found another solution using a mesh:

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by