Trim line

I’m trying to find a way to trim the lines into a closed line
So can someone help me solution to complete like this picture

One way would be to find the line intersect points and then draw new lines from point to point.

Thanks @MR_D! i will try it!