Programming Help - Trigonometry / Geometry / Mathematicians

Consider that I have a vector of points, that are NOT in sequence, but when they're all drawn they form a contiguous line as shown below in black.

http://www.imprint-aa.com/sama/peaks.jpg

how can I pragmatically extract the peaks and dips, as shown by the red crosses?

I can order the points to be in sequence, but this will eats up valuable CPU clocks.

I have an idea to track the direction of travel and monitor the change in cardinal directions, waiting until a loop of directions has been passed (like N > NE > E > SE) but this is a tricky algorithm to implement, and can get expensive with having to first order the points, then do the scanning.

I'm looking for a more elegant solution before I attempt the above.

any ideas?