am_primitive.cpp File Reference
`#include <fctsys.h>`
`#include <common.h>`
`#include <macros.h>`
`#include <trigo.h>`
`#include <convert_to_biu.h>`
`#include <convert_basic_shapes_to_polygon.h>`
`#include <gr_basic.h>`
`#include <math/util.h>`
`#include <gerbview.h>`
`#include <gerber_file_image.h>`

Go to the source code of this file.

## Macros

#define TO_POLY_SHAPE

## Functions

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

static wxPoint mapPt (double x, double y, bool isMetric)
Function mapPt translates a point from the aperture macro coordinate system to our deci-mils coordinate system. More...

## Variables

const int seg_per_circle = 64

## ◆ TO_POLY_SHAPE

 #define TO_POLY_SHAPE
Value:
{ aShapeBuffer.NewOutline(); \
for( unsigned jj = 0; jj < polybuffer.size(); jj++ )\
aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y );\
aShapeBuffer.Append( polybuffer[0].x, polybuffer[0].y );}

## ◆ mapPt()

 static wxPoint mapPt ( double x, double y, bool isMetric )
static

Function mapPt translates a point from the aperture macro coordinate system to our deci-mils coordinate system.

Returns
wxPoint - The GerbView coordinate system vector.

Definition at line 56 of file am_primitive.cpp.

57 {
58  wxPoint ret( scaletoIU( x, isMetric ), scaletoIU( y, isMetric ) );
59
60  return ret;
61 }
int scaletoIU(double aCoord, bool isMetric)
Function scaletoIU converts a distance given in floating point to our internal units.

References scaletoIU().

## ◆ 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 }
#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:61

## ◆ seg_per_circle

 const int seg_per_circle = 64