Re: Sorting 2 'colums'..how?
From: James Connell (jconnell_at_gci.net)
Date: 12/15/03
- Next message: jeffc: "Re: compiler does not find member function"
- Previous message: Chris \( Val \): "Re: Q regarding eof() issue."
- In reply to: wil: "Re: Sorting 2 'colums'..how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 15 Dec 2003 06:38:45 -0900
wil wrote:
> 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
>
it's called "polar" coordinates and instead of x,y ( cartesian <sic>) it
uses a distance and an angle from a given line from the zero point. it's
the same way longitude is used on earth, the prime meridian is the zero
point and you are so many degrees from it. if you use the north pole as
zero than at any point you are so many miles(or whatever) from the pole
and so many degrees from the prime.
- Next message: jeffc: "Re: compiler does not find member function"
- Previous message: Chris \( Val \): "Re: Q regarding eof() issue."
- In reply to: wil: "Re: Sorting 2 'colums'..how?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|