% file: plot_div_orig_from_xform.m
%
% this script requires no arguments
%
% this function plots the curve showing where points are equidistant from
% both sets in the transformed space. it does this by determining
% zero-crossings in the difference of the distances
%

% initialize the size of the sample data
%
index = 1;

% plot between two somewhat arbitrary x values that fit the data chosen for
% this experiment
%
for x = 5.0:-0.1:-5.0

	% set the difference to zero
	%
	diff_old = 0.0;

	% plot between two somewhat arbitrary y values that fit the data chosen
	% for this experiment
	%	
	for y = 5.0:-0.1:-5.0

		% compute the distances
		%
		dist1_new = dist(mean_xform_set_1, (transform_1 * transpose([x,y])));
		dist2_new = dist(mean_xform_set_2, (transform_2 * transpose([x,y])));

		% compute the difference between the distances
		%
		diff_new = dist2_new - dist1_new;
		
		% see if the sign of the distance difference has changed. if so
		% then add the point to the plot data and increment the index
		% value
		%
		if (diff_new > 0.0) 
			if (diff_old < 0.0)
				plot_values_xform(index,:) = [x,y];
				index = index + 1;
			end
		elseif (diff_new < 0.0)
			if (diff_old > 0.0)
				plot_values_xform(index,:) = [x,y];
				index = index + 1;
			end
		elseif (diff_new == 0.0)
			plot_values_xform(index,:) = [x,y];
			index = index + 1;
		end

		% set the difference for the next iteration
		%
		diff_old = diff_new;
	end
end

% plot the data points found on the current figure
%
plot(plot_values_xform(:,1), plot_values_xform(:,2), 'k-');

% end of script
%