[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: transition of pcb internal units to metric (SI, mm)



On Sun, 6 Feb 2011 18:57:06 +0100
Markus Hitter <mah@xxxxxxxxxxx> wrote:

> Am 06.02.2011 um 16:24 schrieb Peter Clifton:
> 
> > Imperial parts are not a problem for a sufficiently fine metric  
> > grid. I
> > don't think we should remove the option of working on a Mil grid  
> > though.
> 
> I'm wondering what's the advantage of having an internal grid at
> all. Why not just use doubles, describing a position in meter or  
> millimeter? About all mechanical CAD and picture drawing
> applications do it that way.

Be careful.  Floating point numbers can cause deep problems that are
not immediately apparent.  For instance, you can't represent many basic
values such as 0.1 exactly in floating point.  This problem is
significantly compounded as you perform transformations and arithmetic
using these inexact numbers.  There is a decent introduction at
<http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems>.
Bottom line: Avoid floating point when exact numbers are required.

===================================================================
My summary of prior discussions about changing pcb internal unit to
metric - with my own analysis and opinion
===================================================================

This has been discussed on the list before and the proper answer is to
use 64-bit integers representing length in nanometers.  A 32-bit
integer would work but place an upper limit on board dimensions of
2 meters.

The possibility of performance degradation caused by making use of
64-bit integers was raised as an issue by some on this list.  I believe
the solution is to make the standard internal representation a 64-bit
integers but provide a compile-time configuration option to use
32-bit integer representation for users who desire it and do not need
to design large layouts.

The internal memory representation of lengths in 64-bit or 32-bit
integers will not cause compatibility problems between program versions
or users because all lengths are stored in textual format in pcb layout
and footprint files.  Old files can still be read.  New files should
include units on *all* values to prevent any confusion and for maximum
clarity.

(As a bonus which could be added at a later time, the pcb layout
options for each board or footprint could contain an option "File
format length units" which could be set to "mm", "nm", "mil", or "in".
This would then cause pcb to write out all lengths for that layout or
footprint in the given unit, resulting in a more readable footprint
file when the unit used for output matches the footprint's native unit.)

Besides the obvious work that would be required to implement this
nanometer unit feature, I maintain there are 

(1) a number of strong positive consequences, such as lossless
    representation of footprints and layouts even through repeated
    manipulation, and cleaner footprint files written by pcb due to the
    ability to exactly represent both imperial units and millimeter
    values to any conceivable required precision; and

(2) no significant negative consequences

resulting from the change.

Regards,
Colin


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user