简体   繁体   中英

Change Plot Center or Camera Rotate Point in MATLAB - Earth_example

I'm plotting flight data around a 3D globe in MATLAB using this Earth_example file:

http://www.mathworks.com/matlabcentral/fileexchange/13823-3d-earth-example

In order to examine the flight paths, I'd like to be able to move the rotate point to somewhere along the flight path or at the arrival or departure point, but I can't find a command that will let me do that. I've tried camtarget and campos, but neither let me rotate around a new point in the plot, and campos throws warnings and fails with the 3D Earth plot. Is there a function that lets you update the scene center to make rotating around a new point easy?

Here's a snippet of my code:

%% Calculate & Plot Great Circle Trajectories

for flight = flight_struct
    % [lat,lon] = gcwaypts(lat1,lon1,lat2,lon2,nlegs) - (nlegs = # of waypts along path)
    [lat,lon] = gcwaypts(flight.DepartureLatitude,flight.DepartureLongitude,flight.ArrivalLatitude,flight.ArrivalLongitude,50);

    % 3D Trajectories
    alt = ones(length(lat),1)*cruise_alt;
    lla_pos = [lat,lon,alt];
    ecef_pos = lla2ecef(lla_pos);
    x = ecef_pos(:,1);
    y = ecef_pos(:,2);
    z = ecef_pos(:,3);
    plot3(x,y,z,'r','LineWidth',1)

Thanks for any help/guidance.

I think you're looking for camorbit as seen here:

http://www.mathworks.com/help/matlab/views.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM