Beispiel #1
0
            // add other into this.
            public void combine(c_bounds other)
            {
                // assert(can_combine(other))

                min = Math.Min(min, other.min);
                max = Math.Max(max, other.max);
            }
Beispiel #2
0
 public c_cuboid(
     c_bounds bounds_x_input,
     c_bounds bounds_y_input,
     c_bounds bounds_z_input)
 {
     bounds_x = bounds_x_input;
     bounds_y = bounds_y_input;
     bounds_z = bounds_z_input;
 }
Beispiel #3
0
            // Returns a bounds that is within both this and other
            public c_bounds intersect(c_bounds other)
            {
                if (max < other.min || min > other.max)
                {
                    return(null);
                }

                return(new c_bounds(Math.Max(min, other.min), Math.Min(max, other.max)));
            }
Beispiel #4
0
            // Returns a cuboid that is within both this and other
            public c_cuboid intersect(c_cuboid other)
            {
                c_bounds new_bounds_x = bounds_x.intersect(other.bounds_x);
                c_bounds new_bounds_y = bounds_y.intersect(other.bounds_y);
                c_bounds new_bounds_z = bounds_z.intersect(other.bounds_z);

                if (new_bounds_x == null || new_bounds_y == null || new_bounds_z == null)
                {
                    return(null);
                }

                return(new c_cuboid(new_bounds_x, new_bounds_y, new_bounds_z));
            }
Beispiel #5
0
 // Are this and other flush against each other?
 public bool can_combine(c_bounds other)
 {
     return((this.max + 1 == other.min) || (other.max + 1 == this.min));
 }
Beispiel #6
0
 // Are this and other the exact same
 public bool is_equivalent(c_bounds other)
 {
     return((this.min == other.min) && (this.max == other.max));
 }