Perhaps my approach can serve as a suggestion? It inserts points into lines, moves them or deletes them. This can certainly be modified for the desired result.
Construction of frames with contour/profile
Try it out https://hofk.de/main/threejs/ConstructFrame/ConstructFrame.html
see lines 843, 999 …