Boolean curves intersection

Hi guys!
I want to perform boolean operation on 2 curves(array of vector3 points).

For example circle and square:


What is the easiest way to do it?

You have CSG to do that, but it operates on 3D objects, not 2D.

Note that you can simulate 2D objects if you make your objects very thin…


Thanks Evgeni!

Tried clipper.js and worked as well.