I am building some sort of homemade pyQGIS-Buffer-tool as the existing flat-end-buffer-tools are not working for me ( see v.distance.buffer does not create proper buffers with flat endcaps)
Therefore I am looking for a solution how to get the polygon-vertices of my buffer-polygon where the linesegments have an angle <>180° to each other (see image below).
For start- and endpoint I just make a linear interpolation with 90° angle to the line direction.
Now i wonder how I could get the two points that are marked red in the picture? ( The orange line is my source line I would like to "buffer".) Note: I am not looking for a flat buffer tool but just for a pythonic solution how to get the vertexpoints that are marked in the picture. My first idea was to make parallel lines to my source line, elongate them if nesccessary and find the intersection but this seems a bit cumbersome.
Any ideas how to solve this with pyQGIS or some math.xxx magic?
Here a picture how it looks like at the moment if I just interpolate every vertex 5m with -90° to the line direction:



