- Sep 19, 2000
- 10,283
- 134
- 106
Hey everyone again, I'm in need of some help. Im trying to replicate some functions from another language to c++. One of the functions FindColorsSpiralTolerance is supposed to do a spiral search for colors that are close to a given color within a given tolerance range and return the points that test positive, starting from a given point. There is another function FindColorsTolerance that returns an array of Points to the matching colors. Currently my methodology is like this.
Get the points using FindColorsTolerance,
create an array that is the same length as the one returned from FindColorsTolerance.
Fill the new array with distances from the center point.
heap sort the new array simultaneously switching values in the original point array.
Technically it isn't a spiral search, more of a circular one, but that is close enough for me.
So far these are the options I have been considering.
1. do a different searching method, quicksort maybe.
2. implement a real spiral search rather then this pseudo one.
3. somehow store off the final changes and then re-order the point array based on them.
Overall, I have a working function, it is just slower then I would like, and the sorting is where I am dieing (Profiler tells me this).
Get the points using FindColorsTolerance,
create an array that is the same length as the one returned from FindColorsTolerance.
Fill the new array with distances from the center point.
heap sort the new array simultaneously switching values in the original point array.
Technically it isn't a spiral search, more of a circular one, but that is close enough for me.
So far these are the options I have been considering.
1. do a different searching method, quicksort maybe.
2. implement a real spiral search rather then this pseudo one.
3. somehow store off the final changes and then re-order the point array based on them.
Overall, I have a working function, it is just slower then I would like, and the sorting is where I am dieing (Profiler tells me this).