logo separator

[mkgmap-dev] What's d for? (possibly related to clipping issue?)

From Johann Gail johann.gail at gmx.de on Sat Feb 21 14:56:43 GMT 2009

>> Why does the line clipper add a tiddly amount (d) in these expressions? 
>>
>>
>> 		double d = 0.00001;
>> 		if (t[0] > 0)
>> 			ends[0] = new Coord((int) (y0 + t[0] * dy + d), (int) (x0 + t[0] * dx + d));
>>
>> 		if (t[1] < 1)
>> 			ends[1] = new Coord((int)(y0 + t[1] * dy + d), (int) (x0 + t[1] * dx + d));
>>     
>
> It for rounding to the nearest map unit.  I remember I was just adjusting
> it until I got something that worked, but can't quite remember what the
> problem I was solving was.
>
> If I'd thought about it more I would have said that the correct value would be:
>
>   360/(2 * 2^24)
>
> which comes to 0.000010728, so perhaps close enough.
>
>   
>
Shouldnt this rounding be performed in the constructor of the Coord?
Then the rounding gets applied on every Coord, no matter, how it gets 
constructed.



More information about the mkgmap-dev mailing list