Re: Sorting 2 'colums'..how?

From: James Connell (jconnell_at_gci.net)
Date: 12/15/03


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.



Relevant Pages

  • Re: Discovery Landing - Charred Sides?
    ... On entry, they fly a zero angle of sideslip, well, what the On-Board ... Its of the other side of the orbiter: ...
    (sci.space.shuttle)
  • Re: OT: FOAK Windmill Boat/Cart
    ... rational reference for angle of attack. ... lift is some positive angle of a few degrees. ... It is good for any wing which is set to produce zero lift, ...
    (uk.rec.motorcycles)
  • Re: GPS GR Correction Myth.
    ... Nor does it produce an ellipse. ... M is greater than a right angle, ... you forgot that the force goes to zero at zero displacement then ... of 1000 to fit the screen, I could easily go to 100,000,000 pts if I ...
    (sci.physics.relativity)
  • Re: OT: is the AGW bubble about to burst?
    ... JosephKK wrote: ... So a day's worth of unclouded sunlight on the North Pole in ... In fact your 66.55 degree angle represents latitude, ... so using the sine of that angle makes the ...
    (sci.electronics.design)
  • Re: Interpretation of FFT phase
    ... >> part looks to be numerical junk (eg. if fft has some roundoff ... the signal is a sine wave: its spectrum is zero almost ... The output of angle is thus random here ...
    (comp.soft-sys.matlab)