← Back to team overview

kicad-developers team mailing list archive

Re: Internal PCB Units?

 

--- In kicad-devel@xxxxxxxxxxxxxxx, "gharlandau" <gharlandau@...> wrote:
> I am certainly aware, and have been for a long time (as in decades), thatone inch is (*exactly*) equal to 25.4mm.

Interesting constant found while examining kicad sources:
----
./common/common.cpp: value = val * 25.4000508001016 / internal_unit_value;
./common/common.cpp: value = val * internal_unit_value / 25.4000508001016;
./common/base_screen.cpp: x = size.x / 25.4000508001016;
./common/base_screen.cpp: y = size.y / 25.4000508001016;
./common/base_screen.cpp: x = size.x / 2.54000508001016;
./common/base_screen.cpp: y = size.y / 2.54000508001016;
./eeschema/class_sch_screen.cpp:#define MM_TO_SCH_UNITS 1000.0 / 25.4000508001016
./pcbnew/classpcb.cpp:#define MM_TO_PCB_UNITS 10000.0 / 25.4000508001016
----
25.4000508001016 is equal to 0.03937 in double precision. I cannot find reason to use this instead of plain 25.4 (rounding issues?). If I'm right, these all should be changed. Or, if there is any reason to leave them, someoneplease explain.







References