Kuba Ober wrote: >> You calculating center wrong: >> > + ret = (props->lMax-props->lMin)/2; >> >> This won't work for min=1000 max=2000. > > But it does. Maybe you meant if min/max were switched? In such case > > ret = (props->lMax-props->lMin)/2; > if (props->lMax < props->lMin) ret = -ret; > > Cheers, Kuba
If ret is meant to have a value that is half way between props->lMax and props->lMin, then I believe there should be a "+" between them, not a "-". In other words: ret = (props->lMax + props->lMin) / 2; -- Andy.