Three.js 2D CSG - intersect, union, subtract

1.5k Views Asked by At

I'm using csg.js with three.js and it seems it only supports 3D CSG. Check this

I would like to intersect and union 2D (three.js)geometries. Is there any way I can do 2D CSG with three.js ?

1

There are 1 best solutions below

2
M - On

The thing you must consider is that planes are infinitely thin. So when 2 planes intersect, you'll get a one-dimensional line, which has no faces to render. If you use a 2D plane with a solid, it might still not work, since one of the inputs is not a solid and the plugin name suggests it works on solids.

Take into consideration what types of output you'll get when two types of geometry intersect:

If you want a plane as output, I recommend you intersect with a very thin box, for example a 2 x 2 x 0.01, instead of using real 2D planes. Think of it as a cookie-cutter.

Also, make sure you're using manifold geometry, instead of non-manifold, which you can read up on here: https://blender.stackexchange.com/questions/7910/what-is-non-manifold-geometry