KiCad PCB EDA Suite
convert_to_biu.h File Reference

Go to the source code of this file.

Macros

#define CONVERT_TO_BIU_H_
 
#define UNKNOWN_IU
 
#define MAX_ZOOM_FACTOR   300.0
 
#define ZOOM_COEFF   1.1
 
#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 PcbMils2iu (int mils)
 
constexpr int SchMils2iu (int mils)
 
constexpr int PcbMillimeter2iu (double mm)
 
constexpr int SchMillimeter2iu (double mm)
 
constexpr double PcbIu2Millimeter (int iu)
 
constexpr double SchIu2Millimeter (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

◆ CONVERT_TO_BIU_H_

#define CONVERT_TO_BIU_H_

Definition at line 27 of file numeric_evaluator.cpp.

◆ MAX_ZOOM_FACTOR [1/2]

#define MAX_ZOOM_FACTOR   300.0

◆ MAX_ZOOM_FACTOR [2/2]

#define MAX_ZOOM_FACTOR   300.0

Definition at line 183 of file convert_to_biu.h.

◆ UNKNOWN_IU [1/2]

#define UNKNOWN_IU

Scaling factor to convert mils to internal units.

Definition at line 49 of file convert_to_biu.h.

◆ UNKNOWN_IU [2/2]

#define UNKNOWN_IU

◆ ZOOM_COEFF [1/2]

#define ZOOM_COEFF   1.1

Definition at line 187 of file convert_to_biu.h.

◆ ZOOM_COEFF [2/2]

#define ZOOM_COEFF   1.1

Function Documentation

◆ PcbIu2Millimeter()

constexpr double PcbIu2Millimeter ( int  iu)
inline

Definition at line 130 of file convert_to_biu.h.

131 {
132  return iu / PCB_IU_PER_MM;
133 }
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 121 of file convert_to_biu.h.

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

References PCB_IU_PER_MM.

Referenced by NET_SETTINGS::NET_SETTINGS().

◆ PcbMils2iu()

constexpr int PcbMils2iu ( int  mils)
inline

Definition at line 110 of file convert_to_biu.h.

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

References PCB_IU_PER_MILS.

◆ SchIu2Millimeter()

constexpr double SchIu2Millimeter ( int  iu)
inline

Definition at line 134 of file convert_to_biu.h.

135 {
136  return iu / SCH_IU_PER_MM;
137 }
constexpr double SCH_IU_PER_MM

References SCH_IU_PER_MM.

◆ SchMillimeter2iu()

constexpr int SchMillimeter2iu ( double  mm)
inline

Definition at line 125 of file convert_to_biu.h.

126 {
127  return (int) ( mm < 0 ? mm * SCH_IU_PER_MM - 0.5 : mm * SCH_IU_PER_MM + 0.5 );
128 }
constexpr double SCH_IU_PER_MM

References SCH_IU_PER_MM.

◆ SchMils2iu()

constexpr int SchMils2iu ( int  mils)
inline

Definition at line 115 of file convert_to_biu.h.

116 {
117  double x = mils * SCH_IU_PER_MILS;
118  return int( x < 0 ? x - 0.5 : x + 0.5 );
119 }
constexpr double SCH_IU_PER_MILS

References SCH_IU_PER_MILS.

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.

Referenced by PcbMils2iu().

◆ PCB_IU_PER_MM

constexpr double PCB_IU_PER_MM = 1e6

Definition at line 35 of file convert_to_biu.h.

Referenced by PcbIu2Millimeter(), and PcbMillimeter2iu().

◆ 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 SchMils2iu().

◆ SCH_IU_PER_MM

constexpr double SCH_IU_PER_MM = 1e4

Definition at line 37 of file convert_to_biu.h.

Referenced by SchIu2Millimeter(), and SchMillimeter2iu().