### Part and material geometry

Nesting is a process of creating a layout for geometrical shapes in the specified raw material sheets. Typically, nested parts are represented with irregular shapes and material is defined as rectangular sheet. Parts often contain holes. Depending on the nesting settings other smaller parts can be nested inside bigger parts holes. Part geometry is defined by curves forming closed contours. For a simple shape without holes, part geometry is a single outer contour. When the part contains holes, it is built from an outer contour and number of inner contours representing holes or restricted area.

### Shape definition

As input to the Nesting Center API the geometrical data should be collected in JSON object. Each part or material object contains array of contours under property "Contours". Usually the first element in the array is the outer contour and the remaining array elements represent the inner contours. Contours can be classified as oriented clockwise or counter-clockwise. In nesting computations it is important to define elements with correct orientation.

Rules for contour directions:

• Parts
The outer contour should be counter-clockwise and the inner contours should be clockwise.
• Material
The outer contour should be clockwise and the inner contours should be counter-clockwise.

A contour is composed of line and arc segments. A contour vertex is defined by an (X, Y) position and optional arc bulge.

A line segment starts at the given vertex (X, Y) position and ends at the following vertex (X, Y) position.

An arc segment starts at the given vertex (X, Y) position and ends at the following vertex (X, Y) position when a non-zero bulge is specified. The bulge is the tangent of 1/4 of the angle for the arc between the starting vertex and the ending vertex. If a bulge is positive it means that the arc direction is counter-clockwise. If a bulge is negative it means that the arc direction is clockwise.

### Part example

```{
"Contours": [
{
"Vertices": [
{
"X": 0,
"Y": 0
},
{
"X": 250,
"Y": 0,
"B": 0.6
},
{
"X": 250,
"Y": 200
},
{
"X": 0,
"Y": 200
}
]
},
{
"Vertices": [
{
"X": 150,
"Y": 100,
"B": -1
},
{
"X": 250,
"Y": 100,
"B": -1
}
]
}
]
}

```