T
Tamir Khason
Let's say I have Point[] and I want to sort it circle way (e.g.
2;2.4;1,8;2,8,5;4;8,2;7,1;4
The algo for this is:
if ((p.X<p[i+1].X & p.Y<Avg(p).Y & p[i+1].Y<Avg(p).Y) |
(p.X>p[i+1].X & p.Y>Avg(p).Y & p[i+1].Y>Avg(p).Y) )
Swap(p,p[i+1]);
where Avg(p).Y is the middle (average) of all Y values.
Other words:
First of all all point with Y above the Middle of Ys acsending and then
all point with Y under the Middle of Ys descending
Is there more effecient way to do this except buble sort for 2 axes?
TNX
2;2.4;1,8;2,8,5;4;8,2;7,1;4
The algo for this is:
if ((p.X<p[i+1].X & p.Y<Avg(p).Y & p[i+1].Y<Avg(p).Y) |
(p.X>p[i+1].X & p.Y>Avg(p).Y & p[i+1].Y>Avg(p).Y) )
Swap(p,p[i+1]);
where Avg(p).Y is the middle (average) of all Y values.
Other words:
First of all all point with Y above the Middle of Ys acsending and then
all point with Y under the Middle of Ys descending
Is there more effecient way to do this except buble sort for 2 axes?
TNX