Let P1 = (x1,y1), P2 = (x2,y2), P3 = (x3,y3) be the three points and their respective coordinates. Perform these computations:
A4 = 2*((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));
R2 = [x1^2+y1^2,x2^2+y2^2,x3^2+y3^2]/A4;
x0 = dot([y2-y3,y3-y1,y1-y2],R2);
y0 = dot([x3-x2,x1-x3,x2-x1],R2);
a1 = mod(atan2(-(x1-x0),y1-y0),2*pi);
a2 = mod(atan2(-(x2-x0),y2-y0),2*pi);
a3 = mod(atan2(-(x3-x0),y3-y0),2*pi);
[~,ix] = sort([a1,a2,a3]);
M = [x1,y1;x2,y2;x3,y3];
M = M(ix,:);
Array M will be the coordinate pairs listed in counterclockwise order around from the "top" of the circle. If you want to go in clockwise order, just apply 'fliplr' to 'ix' or else do a descending 'sort'.
Best Answer