How to clip polyline

Hello All,

I have curve line that help me to create polygon like structures in my tool and my polylines are similar as autocad polylines.

Now i am looking into a way that help me to split the polyline.

Let say if the polyline is forming an square and i draw an another polyline and try to split the square into two triangles so how i can do that with three js.

Thanks