Example #1
0
 public Node clone() {
   Node node = new Node();
   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 ArrayList<Polygon>();
   for (Polygon polygon : polygons) {
     node.polygons.add(polygon.clone());
   }
   return node;
 }
Example #2
0
 // Remove all polygons in this BSP tree that are inside the other BSP tree
 // `bsp`.
 public void clipTo(Node bsp) {
   this.polygons = bsp.clipPolygons(this.polygons);
   if (this.front != null) this.front.clipTo(bsp);
   if (this.back != null) this.back.clipTo(bsp);
 }