public csgjs_csgnode clone() { csgjs_csgnode ret = new csgjs_csgnode(); foreach (csgjs_polygon p in polygons) { ret.polygons.Add(p.clone()); } ret.plane = plane.clone(); if (front != null) { ret.front = front.clone(); } if (back != null) { ret.back = back.clone(); } return(ret); }
// 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); }
// Return a new CSG solid representing space both this solid and in the // solid `csg`. Neither this solid nor the solid `csg` are modified. public static csgjs_csgnode csg_intersect( csgjs_csgnode a1, csgjs_csgnode b1) { csgjs_csgnode a = a1.clone(); csgjs_csgnode b = b1.clone(); a.invert(); b.clipTo(a); b.invert(); a.clipTo(b); b.clipTo(a); a.build(b.allPolygons()); a.invert(); csgjs_csgnode ret = new csgjs_csgnode(a.allPolygons()); a = null; b = null; return ret; }