Esempio n. 1
0
 public void clipTo(CSGNode bsp)
 {
     this.polygons = bsp.clipPolygons(this.polygons);
     if (this.front != null)
     {
         this.front.clipTo(bsp);
     }
     if (this.back != null)
     {
         this.back.clipTo(bsp);
     }
 }
Esempio n. 2
0
        public CSG union(CSG csg)
        {
            CSGNode a = new CSGNode(this.clone().polygons);
            CSGNode b = new CSGNode(csg.clone().polygons);

            a.clipTo(b);
            b.clipTo(a);
            b.invert();
            b.clipTo(a);
            b.invert();
            a.build(b.allPolygons());
            return(CSG.fromTriangles(a.allPolygons()));
        }
Esempio n. 3
0
        public CSGNode clone()
        {
            CSGNode node = new CSGNode();

            node.plane = this.plane == null ? null : this.plane.clone();
            node.front = this.front == null ? null : this.front.clone();
            node.back  = this.back == null ? null : this.back.clone();

            node.polygons = new List <CSGPolygon>();

            foreach (CSGPolygon p in this.polygons)
            {
                node.polygons.Add(p.clone());
            }

            return(node);
        }