A syntax called 'gcode' is used to tell CNC engraving machines how to move. An example of gcode is as follows :
G00 Z1 F800 (lift z axis by 1mm)
G00 X49.546785 Y-11.48703 F800 (Go to these coordinates at 800mm/m)
G01 Z-0.35 F100 (Penetrate. Lower the tool into the work by 0.35mm)
G03 X49.126859 Y-11.464812 I-0.385599 J-3.308393 F80 (cut an anticlockwise arc at 80mm/m)
(arc ends at X,Y, arc centre is x+i, y+j)
etc.
As you can see we can describe the movement of the tool in stright lines (G0,G1) and in arcs (G2,G3) from coordinates in the x,y and z planes. Using this mechanism we can draw (engrave) paths, often they are closed paths as below:
In this image we see a closed path (letter a) in black. The green outline is the same path but 'scaled upwards' and the red path is the same path but scaled downwards. In Inkscape we can do this using the 'dynamic offset' tool.
I am looking for an algorithm I can apply to gcode (as described above) to scale paths as described. My first thought is literally to just scale every single line and arc :
Say we are scaling by 'n'% Essentially we would make every line n% longer, and every arc n% bigger. But what would the resulting path centre on?
Does anyone know the name of this algorithm, or have any links or examples of how to achieve this in say, SVG or any other coordinate based system (preferably in python if possible).
Addendum :
The process of scaling polygons inwards and outwards largely has two distinct names: 'Dilation' and 'offsetting'.