Path: news.mathworks.com!not-for-mail
From: "Mahdieh" <mahdieh.emrani@capitalhealth.ca>
Newsgroups: comp.soft-sys.matlab
Subject: sorting, 2D vector, puzzle piece shaped
Date: Fri, 14 Nov 2008 15:47:01 +0000 (UTC)
Organization: Glenrose Research Building
Lines: 18
Message-ID: <gfk6hl$snc$1@fred.mathworks.com>
Reply-To: "Mahdieh" <mahdieh.emrani@capitalhealth.ca>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1226677621 29420 172.30.248.35 (14 Nov 2008 15:47:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Nov 2008 15:47:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1449772
Xref: news.mathworks.com comp.soft-sys.matlab:500852


I have a nx2 vector, which includes the XY coordinates of the n points. 

When plotted, these points create a shape looking like a puzzle piece. 
Now, I need to sort this vector, such that by connecting two consequent points in the vector, I would get the permieter of the shape. i.e. consequent points in the vector, correspond to adjacent point in the graph. 

I have tried:
1-  a. calculating the centroid, b. choosing one point in the vector c. sorting based on the angle between two lines, one passing through centroid and b.point, other line passing through centroid and any point on the vector ...

2- a. dividing the shape into 4 quadrants, b. sorting each quadrant based on X or Y c. connecting them together 

none of the methods, accomplish sorting the whole shape ...

I am out of algorithms, 
any help would be really appreciated ...

Thanks a lot
-Mah