KiCad PCB EDA Suite
convert_to_biu.h File Reference

Go to the source code of this file.

Macros

#define UNKNOWN_IU
 Scaling factor to convert mils to internal units. More...
 
#define MAX_ZOOM_FACTOR   300.0
 
#define ZOOM_COEFF   1.1
 

Functions

constexpr int SchMils2iu (int mils)
 
constexpr double SchIu2Mils (int iu)
 
constexpr int PcbMillimeter2iu (double mm)
 
constexpr double PcbIu2Millimeter (int iu)
 

Variables

constexpr double GERB_IU_PER_MM = 1e5
 some define and functions to convert a value in mils, decimils or mm to the internal unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil) depending on compile time option More...
 
constexpr double PCB_IU_PER_MM = 1e6
 
constexpr double PL_IU_PER_MM = 1e3
 
constexpr double SCH_IU_PER_MM = 1e4
 
constexpr double PCB_IU_PER_MILS = (PCB_IU_PER_MM * 0.0254)
 
constexpr double SCH_IU_PER_MILS = (SCH_IU_PER_MM * 0.0254)
 

Macro Definition Documentation

◆ MAX_ZOOM_FACTOR

#define MAX_ZOOM_FACTOR   300.0

Definition at line 174 of file convert_to_biu.h.

◆ UNKNOWN_IU

#define UNKNOWN_IU

Scaling factor to convert mils to internal units.

Definition at line 49 of file convert_to_biu.h.

◆ ZOOM_COEFF

#define ZOOM_COEFF   1.1

Definition at line 178 of file convert_to_biu.h.

Function Documentation

◆ PcbIu2Millimeter()

constexpr double PcbIu2Millimeter ( int  iu)
inline

Definition at line 124 of file convert_to_biu.h.

125 {
126  return iu / PCB_IU_PER_MM;
127 }
constexpr double PCB_IU_PER_MM

References PCB_IU_PER_MM.

Referenced by NET_SETTINGS::NET_SETTINGS().

◆ PcbMillimeter2iu()

constexpr int PcbMillimeter2iu ( double  mm)
inline

Definition at line 120 of file convert_to_biu.h.

121 {
122  return (int) ( mm < 0 ? mm * PCB_IU_PER_MM - 0.5 : mm * PCB_IU_PER_MM + 0.5 );
123 }
constexpr double PCB_IU_PER_MM

References PCB_IU_PER_MM.

Referenced by NET_SETTINGS::NET_SETTINGS().

◆ SchIu2Mils()

constexpr double SchIu2Mils ( int  iu)
inline

Definition at line 115 of file convert_to_biu.h.

116 {
117  return iu / SCH_IU_PER_MILS;
118 }
constexpr double SCH_IU_PER_MILS

References SCH_IU_PER_MILS.

Referenced by NET_SETTINGS::NET_SETTINGS().

◆ SchMils2iu()

constexpr int SchMils2iu ( int  mils)
inline

Definition at line 110 of file convert_to_biu.h.

111 {
112  double x = mils * SCH_IU_PER_MILS;
113  return int( x < 0 ? x - 0.5 : x + 0.5 );
114 }
constexpr double SCH_IU_PER_MILS

References SCH_IU_PER_MILS.

Referenced by NET_SETTINGS::NET_SETTINGS().

Variable Documentation

◆ GERB_IU_PER_MM

constexpr double GERB_IU_PER_MM = 1e5

some define and functions to convert a value in mils, decimils or mm to the internal unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil) depending on compile time option

Definition at line 34 of file convert_to_biu.h.

◆ PCB_IU_PER_MILS

constexpr double PCB_IU_PER_MILS = (PCB_IU_PER_MM * 0.0254)

Definition at line 107 of file convert_to_biu.h.

◆ PCB_IU_PER_MM

constexpr double PCB_IU_PER_MM = 1e6

◆ PL_IU_PER_MM

constexpr double PL_IU_PER_MM = 1e3

Definition at line 36 of file convert_to_biu.h.

◆ SCH_IU_PER_MILS

constexpr double SCH_IU_PER_MILS = (SCH_IU_PER_MM * 0.0254)

Definition at line 108 of file convert_to_biu.h.

Referenced by SchIu2Mils(), and SchMils2iu().

◆ SCH_IU_PER_MM

constexpr double SCH_IU_PER_MM = 1e4

Definition at line 37 of file convert_to_biu.h.