function [Right_Seeds Left_Seeds] = Find_Left_Right(Seeds)
% X = [randn(100,2)+ones(100,2);...
%      randn(100,2)-ones(100,2)];
X=Seeds';
opts = statset('Display','final');

[idx,ctrs] = kmeans(X,3,...
                    'Distance','sqEuclidean',...
                    'Replicates',5);%,...
                   %'Options',opts);
                
figure;
plot3(X(idx==1,1),X(idx==1,2),X(idx==1,3),'r.','MarkerSize',12)
hold on
plot3(X(idx==2,1),X(idx==2,2),X(idx==2,3),'b.','MarkerSize',12)
plot3(X(idx==3,1),X(idx==3,2),X(idx==3,3),'g.','MarkerSize',12)
plot3(ctrs(:,1),ctrs(:,2),ctrs(:,3),'kx',...
     'MarkerSize',12,'LineWidth',2)
plot3(ctrs(:,1),ctrs(:,2),ctrs(:,3),'ko',...
     'MarkerSize',12,'LineWidth',2)
legend('Cluster 1','Cluster 2','Centroids',...
       'Location','NW')
% hold off   
axis equal;

A =ctrs(1,:)';
B =ctrs(2,:)';
C =ctrs(3,:)';

N=cross(A-B,A-C);

D=-N'*A;
% D=-N'*B
% D=-N'*C

idx=sign(N'*Seeds+D);    

aa=mean(X(idx==1,:)',2);
bb=mean(X(idx==-1,:)',2);
if aa(1) > bb(1) 
    Right_Seeds=X(idx==1,:)';
    Left_Seeds=X(idx==-1,:)';
else
     Right_Seeds=X(idx==-1,:)';
    Left_Seeds=X(idx==1,:)';
end
    

