Change Plot Center or Camera Rotate Point in MATLAB - Earth_example

718 views Asked by At

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.

1

There are 1 answers

3
anon01 On BEST ANSWER

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

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