public CsgTree Clip(CsgTree pair) { var tn = new Node(new List <PG>(this.polygons)); var pn = new Node(new List <PG>(pair.polygons)); tn.ClipTo(pn); return(new CsgTree(tn.GetPolygonData().ToArray())); }
public CsgTree Union(CsgTree pair) { var tn = new Node(new List <PG>(this.polygons)); var pn = new Node(new List <PG>(pair.polygons)); tn.ClipTo(pn); pn.ClipTo(tn); pn.Invert(); pn.ClipTo(tn); pn.Invert(); tn.Build(pn.GetPolygonData()); return(new CsgTree(tn.GetPolygonData().ToArray())); }
public CsgTree Oparation(CsgTree pair, OpType op) { switch (op) { case OpType.Union: return(Union(pair)); case OpType.Subtraction: return(Subtraction(pair)); case OpType.Intersection: return(Intersection(pair)); case OpType.Clip: return(Clip(pair)); default: throw new System.Exception(); } }
public CsgTree(CsgTree src) { polygons = Util.Clone(src.polygons); }