~cern-kicad/kicad/kicad-pns-tom

« back to all changes in this revision

Viewing changes to include/convert_to_biu.h

  • Committer: Maciej Suminski
  • Date: 2013-08-02 13:57:24 UTC
  • mfrom: (4024.1.238 kicad)
  • mto: This revision was merged to the branch mainline in revision 4221.
  • Revision ID: maciej.suminski@cern.ch-20130802135724-gix6orezshkukodv
Upstream merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
#endif
56
56
}
57
57
 
 
58
#elif defined (PL_EDITOR)
 
59
#define IU_PER_MM           1e3 // internal units in micron (should be enough)
 
60
#define IU_PER_MILS       (IU_PER_MM * 0.0254)
 
61
#define IU_PER_DECIMILS   (IU_PER_MM * 0.00254)
 
62
/// Convert mils to page layout editor internal units (iu).
 
63
inline int Mils2iu( int mils )
 
64
{
 
65
    double x = mils * IU_PER_MILS;
 
66
    return int( x < 0 ? x - 0.5 : x + 0.5 );
 
67
}
 
68
 
 
69
/// Convert deci-mils to page layout editor internal units (iu).
 
70
inline int DMils2iu( int dmils )
 
71
{
 
72
    double x = dmils * IU_PER_DECIMILS;
 
73
    return int( x < 0 ? x - 0.5 : x + 0.5 );
 
74
}
 
75
 
58
76
#else            // Eeschema and anything else.
59
 
 
60
77
#define IU_PER_DECIMILS     0.1
61
78
#define IU_PER_MILS         1.0
62
79
#define IU_PER_MM           (IU_PER_MILS / 0.0254)