>The proper way to find the closest point in 3-space is to pre-process the
>point set to generate a 3D voronoi diagram. A voronoi diagram is a
>partitioning of space into regions, each of which contains all points which
>are closer to one point than to any others. These regions are polyhedra.
>There are algorithms for efficiently finding which region a point falls in.
>Of course, all this is overkill, since you shouldn't be doing RGB to index
>conversions in time-critical inner loops!

Right.  A slightly easier implementation is to keep the colors sorted in
three arrays, one for each color.  (each array slot would contain the color
component and the index, so memory used is 3 * 256 *2; perhaps 1 or 2
sorted arrays would be enough for a good improvement). Then you only need
to search the intersection of the parts of each list which are close enough
to possibly match.

Russ



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to