几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】odcmentitycolorlookupaci (http://www.dimcax.com/hust/showthread.php?t=17441)

yang686526 2009-05-06 07:13 PM

【转帖】odcmentitycolorlookupaci
 
odcmentitycolor::lookupaci
odcmentitycolor::lookupaci
hi,
is odcmentitycolor::lookupaci fast? i mean - when there is 255 colors in aci, how many comparisions (average) is done when calling lookupaci with random rgb colors?
regards,
michal sliwka

i think it is not very fast (255 comparisons).
do you know a better approach?
sincerely yours,
george udov
the expression:
oduint32 curdif = 30*difred*difred + 59*difgreen*difgreen + 11*difblue*difblue;
was calculated 256 times to find minimal color difference.
today i optimized it to skip the rest of comparisons if difference is zero. it will not produce significant effect for random rgb color (probability of exact matching is too low). but for colors in cad application it may improve performance because simple colors like black, white, red, green etc. are used more frequently than random rgb.
sergey slezkin
i'm sorry, i forgot about this thread (what do you think about mail notifications for forum users?)
i think that one of possible solutions is to use kd-tree. it's structure for k-dimensional data (in our case - 3 dimensional - rgb) and fast nearest point searching to given one.
regards,
michal sliwka
mail notifications are on by default. probably you have not specified your e-mail or turned notifications off. check you profile, please.
as i understand kd-tree can be used to find only exact math. for arbitrary rgb in general we need to find nearest color. and all 3 components with weights are used to calculate the "color difference" value...
sergey slezkin


所有的时间均为北京时间。 现在的时间是 04:38 PM.