Geometric elements

Overview

The geometry describes entities in the 2-dimensional euclidean space. The representation given here is an adaption of the SVG specification to the needs for 2D sheet metal cutting.

There are four concepts introduced in this document:

Shape

Current version: 1.0

A shape is defined by a combination of points, curves, and regions.

A shape is given by:

{
    "points": [ // optional
        <Point_V1>,
        ...
    ],
    "curves":  [// optional
        <Curve_V1>,
        ...
    ],
    "regions": [ // optional
        <Region_V1>,
        ...
    ]
}

If any of the points, curves or regions lists is empty, it can be omitted altogether.

Note that points, curves and regions MAY intersect or touch each other without restrictions.

Region

Current version: 1.0

A region is a connected closed set. A region is defined by simple closed curves called contours. There shall be one contour called outer contour such that all other contours lie in the interior defined by this contour. The remaining contours are called inner contours. A point p belongs to a region if and only if p lies on the outer contour or in the interior of the outer contour but not in the interior of any inner contour.

{
    "outerContour": <ClosedCurve_V1>, // required
    "innerContours": [ // optional
        <ClosedCurve_V1>,
        ...
    ]
}

A region may contain any number of inner contours, including none. If there are no inner contours, the innerContours element can be omitted. The contour curves of a region MUST not self-intersect or intersect any other contour of the same region. Note that this does not rule out intersections of a region’s contour with other curves, points, or regions.

tbd.: Is is ok for a contour to merely touch itself or other contours of the same region? If so, how can be reliably tell the difference to forbidden intersections?

Curve

Current version: 1.0

A (plane) curve is given in mathematical terms as the image of a continuous function γ: [0,1] → ℝ2. The map γ is called the parametrization of the curve. The point γ(0) is called starting point of the curve and γ(1) is called end point. If γ(0) = γ(1) then the curve is called closed. If the map γ|(0,1): (0,1) → ℝ2 is injective then the curve is called simple. By the Jordan curve theorem a simple closed curve divides the plane into an interior and exterior. More formaly, the complement ℝ2∖C has exactly two connected components. One of these is bounded (the interior) and the other is unbouded (the exterior).

A curve is represented here by a sequence of lines and arcs. The lines and arcs making up a curve are called segments. An open curve has a starting point, which is missing in closed curves. Each segment starts at the end point of the preceeding segment. The first segment starts at the defined starting points, if a starting point is defined (open curve) or at the end point of the last segment for closed curves. The segments of a curve are specified as follows:

Line segments

{
    "type": "LINE", // required
    "x": 10.0, // required
    "y": 20.5 // required
}

Arc segments

{
    "type": "ARC", // required
    "r": 50.0, // required
    "cw": true, // required
    "x": 120.0, // required
    "y": 150.0 // required
}

The x and y attributes specify the end point of the segment in both cases. r is the radius of the arc and cw specificies the orientation - true for clockwise and false for counter-clockwise.

Full circles and large arcs

The representation for arcs does not support full circles, because the orientation of the circle relative to the starting point (=end point) would be undefined with just the radius and the orientation. Therefore full circles have to be represented as two arcs with 180° each.

The same is true for any arc with a span angle of >180°. To distinguish between two arcs with identical start- and end points but with 90° clockwise vs. 270° counter-clockwise, an additional flag (such as "large arc") would be needed. Since full circles and almost-full circles have to be represented as two arc segments anyway, arcs >180° are not supported altogether to keep the model simple.

Notes

This representation is an adaption of elliptical arcs as given in the SVG specification to circular arcs. If the radius is smaller than half of the distance between start and end, implementations MUST increase r to the minimal possible radius.

Open curve

An open curve has an explicit starting point defined in start. The first segment uses start as its starting point, while all other elements use the end point of their predecessor as starting point:

{
    "start": // required
    {
        "x": 100.0, // required
        "y": 200.0 // required
    },
    "segments": [ // required
        { /* line or arc segment */ },
        ...
    ]
}

Closed curve

Closed curves have no explicit starting point. Instead the end point of the last element is used as the starting point of the first element. An open and a closed curve can be distinguished by checking the existence of the start element.

{
    /* explicitly no 'start' element here! */
    "segments": [ // required
        { /* line or arc segment */ },
        ...
    ]
}

Point

Current version: 1.0

A point is given by its x and y coordinates:

{
    "x": 100.0, //required
    "y": 200.5 //required
}