Re: Sorting 2 'colums'..how?

From: wil (willy_at_sure.nl)
Date: 12/15/03


Date: Mon, 15 Dec 2003 09:42:55 +0100

On Sun, 14 Dec 2003 15:14:36 -0900, James Connell <jconnell@gci.net>
wrote:

>i'm not sure what you're trying to do.
>
>even qsort() requires that you define your own comparison routine and
>that seems to be where the problem is.
>
>i'm going to guess you want them sorted by closest to the "zero" point.
>if so you might consider converting the xy coordinates to radians and
>ignoring the angle.

Hm....well..i wrote that at a late hour:)
There are no angles involved.

There's a 'map' which has xpos and ypos. There's a currentposition.
There is an array with structs what hold lets say 500 fixed values of
xpos and ypos points all across the 'map'
I need to sort those 500 fixed values sorted in such a way that the
point closest to current pos is at the top...etc..etc..

so if current position is xpos50 ypos50, and 48 48 and 52 52 were in
the database unsorted they would end up next to each other in the
sorted list cause they are both equal distance to 50 50.

But i just can't figure out how to go about this.

cheers,
Will



Relevant Pages

  • Re: Sorting 2 colums..how?
    ... > There's a 'map' which has xpos and ypos. ... So you need to sort on distance. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Marking points read for coordinates
    ... Dim P As Range, PN As String, XPos As Long, YPos As Long ... Dim shp As Shape ... I think the miracles for the lower and middle level users ...
    (microsoft.public.excel.programming)
  • Re: Marking points read for coordinates
    ... Dim P As Range, PN As String, XPos As Long, YPos As Long ... Dim shp As Shape ... Petr Bezucha ...
    (microsoft.public.excel.programming)
  • Re: Draw Rectangle directly to client (ie - without bitmap?)
    ... seat.DrawRectangle(Drawing.Pens.Black, xpos, ypos, 5, 10) ... Perhaps you should draw your rectangles to an image in memory and then ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: test printer code
    ... StartDoc(MyPrinter.Handle, docinf) returns -1 ... In TextPrint 1st Time ... xpos is assigned 1103 ... ypos is assigned 1103 ...
    (microsoft.public.vb.general.discussion)