# Zigzag Pocket Machining

With zigzag pocket machining, the tool is moved forth and back along equally spaced straight lines ("zigzag segments") which all are parallel to a reference line selected initially. In order to form a continuous path, neighboring zigzag segments may be interconnected by moves along the pocket's boundary. The intersection of this family of lines with the pocket naturally defines a machining graph such that the pocket has been machined if all the edges corresponding to the zigzag segments have been traversed. In order to prevent repeated machining of parts of the pocket, we require that each zigzag segment be traversed exactly once.

For a machining graph given, it is natural to try to traverse it such that a minimum number of tool retractions is needed. One may also attempt to select the inclination of the initial reference line in a smart way such that a "better" machining graph is produced, which admits a traversal with less retractions. My own implementations of zigzag pocketing attempt to carry out both optimizations.

Related publications:

M. Held (1991):
``On the Computational Geometry of Pocket Machining''.
Lecture Notes in Computer Science, vol. 500, Springer-Verlag, June 1991.

M. Held (1991):
``A Geometry-Based Investigation of the Tool Path Generation for Zigzag Pocket Machining''.
The Visual Computer 7(5-6):296-308, Sep 1991.

E.M. Arkin, M. Held, C.L. Smith (2000):
``Optimization Problems Related to Zigzag Pocket Machining''.
Algorithmica 26(2):197--236, 2000.

The following images show tool paths for sample pockets which were computed by means of my pocketing codes. (Click on an image icon in order to see the full-size image. The full-size images have 1000x700 pixels.)

 This image shows the machining graph of a simple polygonal pocket. Note the inclination of the zigzag path, which was chosen by my pocketing software.
 This image shows the corresponding zigzag path. Note that no retraction is necessary in order to traverse the machining graph.

 This image shows the machining graph of a polygonal pocket with 1 hole. Again, the inclination of the zigzag path was chosen by my pocketing software.
 This image shows the corresponding zigzag path. Note that only one retraction is used in order to traverse the machining graph, which clearly is optimal.

 In this example, a horizontal tool path seems to be fine.
 This image shows the corresponding zigzag path. In general, the algorithm guarantees to use at most 5*OPT+6*H retractions, where OPT is the (unknown) minimum number of retractions required for traversing the machining graph given, and H is the number of holes of the pocket. For pockets without holes, the actual performance of the algorithm seems to be about 1.5*OPT.