www.gusucode.com > map 案例源码 matlab代码程序 > map/FindIntersectionsOfPointsOnPairsOfGreatCirclesExample.m

    %% Find intersections of points on circles 
% This example shows how to find the intersection of points on circles.
%%
% Create map axes.

% Copyright 2015 The MathWorks, Inc.

figure('color','w');
ha = axesm('mapproj','mercator', ...
    'maplatlim',[-10 15],'maplonlim',[-10 20],...
    'MLineLocation',5,'PLineLocation',5);
axis off
gridm on
framem on
mlabel on
plabel on
%% 
% Define latitudes and longitudes of three arbitray points, and then define
% three radii, all 8 degrees.
latpts = [0;5;0];           
lonpts = [0;5;10];     
radii = [8;8;8];  
%%
% Obtain the intersections of imagined small circles around these points.
[newlat,newlon] = crossfix(latpts,lonpts,radii,[0;0;0])
%%
% Draw red circle markers at the given points.
geoshow(latpts,lonpts,'DisplayType','point',...
    'markeredgecolor','r','markerfacecolor','r','marker','o')
%%
% Draw magenta diamond markers at the points of intersection.
geoshow(reshape(newlat,6,1),reshape(newlon,6,1),'DisplayType','point',...
    'markeredgecolor','m','markerfacecolor','m','marker','d')
%%
% Generate a small circle 8 deg radius for each original point.
[latc1,lonc1] = scircle1(latpts(1),lonpts(1),radii(1));
[latc2,lonc2] = scircle1(latpts(2),lonpts(2),radii(2));
[latc3,lonc3] = scircle1(latpts(3),lonpts(3),radii(3));
%%
% Plot the small circles to show the intersections are as determined.
geoshow(latc1,lonc1,'DisplayType','line',...
    'color','b','linestyle','-')
geoshow(latc2,lonc2,'DisplayType','line',...
    'color','b','linestyle','-')
geoshow(latc3,lonc3,'DisplayType','line',...
    'color','b','linestyle','-')