See CSG_mum.pdf for algorithm details