← Back to team overview

kicad-developers team mailing list archive

Re: Internal units in the KiCAD source code

 

Le 13/02/2020 à 20:08, jp charras a écrit :
> Le 13/02/2020 à 15:46, Wayne Stambaugh a écrit :
>> Hi Johannes,
>>
>> Thank you for your suggestion but the internal units for each format
>> were chosen for a specific reason.  There really is no justifiable
>> reason to change them as they have been carefully selected based on the
>> requirements of the objects they represent.  Conversion code is provided
>> for each internal unit so plotting to standard units such as
>> millimeters, inches, etc is trivial.  I'm not opposed to adding support
>> for changing the plot units.  I am opposed to changing the internal units.
>>
>> Cheers,
>>
>> Wayne
> 
> I fully agree with Wayne.
> 
> Why these different units (I am talking only about coordinates, not angles):
> Pcbnew uses 1nm.
> Due to the fact a "int" is widely used in code for many calculations, the actual size of a board is roughly
> INT_MAX / 1.414 with a margin: say INT_MAX/2.
> Why INT_MAX / 1.414?
> Because we need to calculate distances (and inside a square, the max dist is INT_MAX / 1.414) and we also
> need margins.

Sorry:
the max dist is INT_MAX inside a square having a size of INT_MAX / 1.414

-- 
Jean-Pierre CHARRAS


References