// Return a new CSG solid representing space in either this solid or in the
        // solid `csg`. Neither this solid nor the solid `csg` are modified.
        public static csgjs_csgnode csg_union(csgjs_csgnode a1, csgjs_csgnode b1)
        {
            csgjs_csgnode a = a1.clone();
            csgjs_csgnode b = b1.clone();

            a.clipTo(b);
            b.clipTo(a);
            b.invert();
            b.clipTo(a);
            b.invert();
            a.build(b.allPolygons());
            csgjs_csgnode ret = new csgjs_csgnode(a.allPolygons());

            a = null;
            b = null;
            return(ret);
        }
 // Remove all polygons in this BSP tree that are inside the other BSP tree
 // `bsp`.
 void clipTo(csgjs_csgnode other)
 {
     polygons = other.clipPolygons(polygons);
     if (front != null)
     {
         front.clipTo(other);
     }
     if (back != null)
     {
         back.clipTo(other);
     }
 }