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...
 

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

◆ UNKNOWN_IU

#define UNKNOWN_IU

Scaling factor to convert mils to internal units.

Definition at line 84 of file convert_to_biu.h.

Function Documentation

◆ PcbIu2Millimeter()

constexpr double PcbIu2Millimeter ( int  iu)
inline

Definition at line 159 of file convert_to_biu.h.

160 {
161  return iu / PCB_IU_PER_MM;
162 }
constexpr double PCB_IU_PER_MM

References PCB_IU_PER_MM.

◆ PcbMillimeter2iu()

constexpr int PcbMillimeter2iu ( double  mm)
inline

Definition at line 155 of file convert_to_biu.h.

156 {
157  return (int) ( mm < 0 ? mm * PCB_IU_PER_MM - 0.5 : mm * PCB_IU_PER_MM + 0.5 );
158 }
constexpr double PCB_IU_PER_MM

References PCB_IU_PER_MM.

Referenced by getInPcbUnits().

◆ SchIu2Mils()

constexpr double SchIu2Mils ( int  iu)
inline

Definition at line 150 of file convert_to_biu.h.

151 {
152  return iu / SCH_IU_PER_MILS;
153 }
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 145 of file convert_to_biu.h.

146 {
147  double x = mils * SCH_IU_PER_MILS;
148  return int( x < 0 ? x - 0.5 : x + 0.5 );
149 }
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 69 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 142 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 71 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 143 of file convert_to_biu.h.

Referenced by SchIu2Mils(), and SchMils2iu().

◆ SCH_IU_PER_MM

constexpr double SCH_IU_PER_MM = 1e4