'Large complex 2d shapes in Libgdx

Im making a game and I want to have very wide stroked lines following objects around on and off the screen over a large area I can pan over and zoom in and out. The thing is, as the lines start to gain more segments, it starts to lag. So I've been switching over to libgdx, also I've working on getting only the path segments that are on the screen to draw, but im realizing it will likely still lag in areas that get a lot of traffic from objects in the game, just drawing line after line overlaping each other with their wide strokes. I thought of saving the path as a bitmap each time and just adding the adjustments to it each time, but then the bitmap would start to get huge as objects start to move outwards, and it would have a lot of unused space where there are no lines. I was also thinking of using like a sprite sheet method just drawing sub images of the whole image but not sure if it would still be slow with such a large image. Lastly I thought of using a shape instead of a path and just editing portions of the outline as objects move outside the areas that are already drawn over, and then again just handle the portions of the shape outline that are on the screen. But the only way I could think to do this is by using complex math to find the points where arcs intersect, since I want the lines to have round caps and joints, then replace those sections of the outline, but that seems a bit complicated. So I'm wondering if theres a better way out there, any suggestions?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source