// Convert solid space to empty space and empty space to solid space.
        void invert()
        {
            for (int i = 0; i < polygons.Count; i++)
            {
                polygons[i].flip();
            }
            plane.flip();
            if (front != null)
            {
                front.invert();
            }
            if (back != null)
            {
                back.invert();
            }

            //std::swap(front, back);
            //hmm - need to swap front and back...

            csgjs_csgnode f = null;
            csgjs_csgnode b = null;

            if (front != null)
            {
                f = front.clone();
            }
            if (back != null)
            {
                b = back.clone();
            }
            back  = f;
            front = b;
        }
        // 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);
        }