function NE_test_angle_2circles
% NE_test_angle_2circles - test all possible PD circle angle combos
% On input:
%     N/A
% On output:
%     figure shows results
% Call:
%     NE_test_angle_2circles
% Author:
%     T. Henderson
%     UU
%     Summer 2023
%

t = [0:0.1:2*pi,2*pi];
x = cos(t);
y = sin(t);

% Test 1: both straight; 90 degrees
C1 = [0,0,Inf,0,1/2];  % y axis
C2 = [0,0,Inf,1/2,0];  % x axis
theta1_2 = NE_angle_2circles(C1,C2);
clf
subplot(2,4,1);
plot(x,y,'k');
axis equal
hold on
plot([0,0],[-1,1],'b');
axis equal
plot([-1,1],[0,0],'r');
title(['Angle: ',num2str(theta1_2*180/pi)]);

% Test 2: both strainght;  45 degree angle
C3 = [0,0,Inf,1/2,1/2]; % 45 degrees
theta1_3 = NE_angle_2circles(C1,C3);
subplot(2,4,2);
plot(x,y,'k');
hold on
axis equal
plot([0,0],[-1,1],'b');
axis equal
plot([-sqrt(2)/2,sqrt(2)/2],[-sqrt(2)/2,sqrt(2)/2],'r');
title(['Angle: ',num2str(theta1_3*180/pi)]);

% Test 3
C4 = NE_ptsPD2line([0.8,0.1],[0.8,-0.1]);
x4 = C4(1) + C4(3)*x;
y4 = C4(2) + C4(3)*y;
theta1_4 = NE_angle_2circles(C1,C4);
subplot(2,4,3);
plot(x,y,'k');
axis equal
hold on
plot([0,0],[-1,1],'b');
axis equal
plot(x4,y4,'r');
if isempty(theta1_4)
    title(['Angle: No intersection']);
else
    title(['Angle: ',num2str(theta1_4*180/pi)]);
end

% Test 4
C5 = NE_ptsPD2line([0,1],[1,0]);
x5 = C5(1) + C5(3)*x;
y5 = C5(2) + C5(3)*y;
theta1_5 = NE_angle_2circles(C1,C5);
subplot(2,4,4);
plot(x,y,'k');
axis equal
hold on
plot([0,0],[-1,1],'b');
axis equal
plot(x5,y5,'r');
title(['Angle: ',num2str(theta1_5*180/pi)]);

% Test 5
C6 = NE_ptsPD2line([-0.2,0.7],[0.2,0.7]);
theta1_6 = NE_angle_2circles(C1,C6);
x6 = C6(1) + C6(3)*x;
y6 = C6(2) + C6(3)*y;
subplot(2,4,5);
plot(x,y,'k');
axis equal
hold on
plot([0,0],[-1,1],'b');
axis equal
plot(x6,y6,'r');
title(['Angle: ',num2str(theta1_6*180/pi)]);

% Test 6
C7 = NE_ptsPD2line([-0.2,0.7],[0.2,0.1]);
theta1_7 = NE_angle_2circles(C1,C7);
x7 = C7(1) + C7(3)*x;
y7 = C7(2) + C7(3)*y;
subplot(2,4,6);
plot(x,y,'k');
axis equal
hold on
plot([0,0],[-1,1],'b');
axis equal
plot(x7,y7,'r');
title(['Angle: ',num2str(theta1_7*180/pi)]);

% Test 7
C8 = NE_ptsPD2line([-0.1,0.8],[0.5,0.5]);
theta7_8 = NE_angle_2circles(C7,C8);
x8 = C8(1) + C8(3)*x;
y8 = C8(2) + C8(3)*y;
subplot(2,4,7);
plot(x,y,'k');
axis equal
hold on
plot(x7,y7,'b');
axis equal
plot(x8,y8,'r');
if isempty(theta7_8)
    title(['Angle: No intersection']);
else
    title(['Angle: ',num2str(theta7_8*180/pi)]);
end

% Test 8
C9 = NE_ptsPD2line([-0.4,0.6],[0.7,0.15]);
theta7_9 = NE_angle_2circles(C7,C9);
x9 = C9(1) + C9(3)*x;
y9 = C9(2) + C9(3)*y;
subplot(2,4,8);
plot(x,y,'k');
axis equal
hold on
plot(x7,y7,'b');
axis equal
plot(x9,y9,'r');
if isempty(theta7_9)
    title(['Angle: No intersection']);
else
    title(['Angle: ',num2str(theta7_9*180/pi)]);
end

tch = 0;
