Re: Sorting 2 'colums'..how?
From: wil (willy_at_sure.nl)
Date: 12/15/03
- Next message: ThoughtCriminal: "function pointer to an external function C++"
- Previous message: Derek Baker: "Re: Top ten errors"
- In reply to: James Connell: "Re: Sorting 2 'colums'..how?"
- Next in thread: Karl Heinz Buchegger: "Re: Sorting 2 'colums'..how?"
- Reply: Karl Heinz Buchegger: "Re: Sorting 2 'colums'..how?"
- Reply: James Connell: "Re: Sorting 2 'colums'..how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: ThoughtCriminal: "function pointer to an external function C++"
- Previous message: Derek Baker: "Re: Top ten errors"
- In reply to: James Connell: "Re: Sorting 2 'colums'..how?"
- Next in thread: Karl Heinz Buchegger: "Re: Sorting 2 'colums'..how?"
- Reply: Karl Heinz Buchegger: "Re: Sorting 2 'colums'..how?"
- Reply: James Connell: "Re: Sorting 2 'colums'..how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|