2021/22/sol2.rb
# returns a list of regions that represent the space in r1 minus the space in r2
returns a list of regions that represent the space in r1 minus the space in r2
returns a list of regions that represent the space in r1 minus the space in r2
def region_diff(r1, r2)
  minx1, maxx1, miny1, maxy1, minz1, maxz1 = r1
  minx2, maxx2, miny2, maxy2, minz2, maxz2 = r2
  if coords_intersect(minx1, maxx1, minx2, maxx2) &&
     coords_intersect(miny1, maxy1, miny2, maxy2) &&
     coords_intersect(minz1, maxz1, minz2, maxz2)
  else
    [r1]
  end
end
def region_diff ( r1 , r2 ) minx1 , maxx1 , miny1 , maxy1 , minz1 , maxz1 = r1 minx2 , maxx2 , miny2 , maxy2 , minz2 , maxz2 = r2 if coords_intersect ( minx1 , maxx1 , minx2 , maxx2 ) && coords_intersect ( miny1 , maxy1 , miny2 , maxy2 ) && coords_intersect ( minz1 , maxz1 , minz2 , maxz2 ) else [ r1 ] end end
returns a list of regions that represent the space in r1 minus the space in r2
returns a list of regions that represent the space in r1 minus the space in r2
r1
<not_specific>
r2
<not_specific>