KiCad PCB EDA Suite
gerber_file_image.cpp File Reference

a GERBER class handle for a given layer info about used D_CODES and how the layer is drawn More...

#include <fctsys.h>
#include <common.h>
#include <macros.h>
#include <convert_to_biu.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerber_file_image.h>
#include <X2_gerber_attributes.h>
#include <algorithm>
#include <map>

Go to the source code of this file.

Functions

int scaletoIU (double aCoord, bool isMetric)
 Function scaletoIU converts a distance given in floating point to our internal units. More...
 

Detailed Description

a GERBER class handle for a given layer info about used D_CODES and how the layer is drawn

Definition in file gerber_file_image.cpp.

Function Documentation

◆ scaletoIU()

int scaletoIU ( double  aCoord,
bool  isMetric 
)

Function scaletoIU converts a distance given in floating point to our internal units.

Definition at line 60 of file rs274_read_XY_and_IJ_coordinates.cpp.

61 {
62  int ret;
63 
64  if( isMetric ) // gerber are units in mm
65  ret = KiROUND( aCoord * IU_PER_MM );
66  else // gerber are units in inches
67  ret = KiROUND( aCoord * IU_PER_MILS * 1000.0 );
68 
69  return ret;
70 }
static constexpr double IU_PER_MM
Mock up a conversion function.
#define IU_PER_MILS
Definition: plotter.cpp:138
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68

References IU_PER_MILS, IU_PER_MM, and KiROUND().

Referenced by GERBER_FILE_IMAGE::StepAndRepeatItem().