% This script allows you to visualize inclusion and exclusion zones for a
% azimuth elevation body mask (.bmsk) in STK

close all; clear all; clc

%% This is an example simple exclusion zone
azel = [20 10 
	20 15
	20 20
	25 20
	30 20
	30 15
	30 10
	25 10];


%% Plot on a sphere 
r = 1.1; %arbitrary radius value
az = azel(:,1); %separate azimuth angles (deg)
el = azel(:,2); %separate elevation angles (deg)
figure;
hold on;

plot3([0, r*1.5],[0, 0],[0, 0],'->k') %x-axis
xlabel = 'X';
text([0, r*1.7],[0, 0],[0, 0],xlabel,'HorizontalAlignment','right') %x-axis label

plot3([0, 0],[0, r*1.5],[0, 0],'->k') %y-axis
ylabel = 'Y';
text([0, 0],[0, r*1.7],[0, 0],ylabel,'HorizontalAlignment','right') %y-axis label

plot3([0, 0],[0, 0],[0, r*1.5],'->k') %z-axis
zlabel = 'Z';
text([0, 0],[0, 0],[0, r*1.7],zlabel,'HorizontalAlignment','right') %z-axis label

plot3(r.*cosd(el).*cosd(az), r.*cosd(el).*sind(az), r.*sind(el), 'k.', 'MarkerSize',10); %plot az/el points 
axis square
sphere(30)
shading flat
view(median(az)+90,median(el)) %set view point
