I have some polyline in the plane, it is necessary to construct two polygons on the left and right of it at given distances.
For example:
Suppose the polyline is set in red, it is necessary to rebuild the left and right polygons A and B relative to it. Thus, polygons A and B are joined in a given polyline. To construct polygons, with preservation of the curvature of the polyline, two distances are specified, for the left and right sides.
The difficulty lies in the fact that I need to know the direction of the polyline in order to move along this direction, at specified distances from it, to obtain the necessary points of the final polygons.
The limitations of the original data: 1) A polyline without self-intersections 2) A polyline cannot be bent, i.e. for example, one point of the X or Y axis is strictly
I am writing in c ++
Throw an idea)

