Question: Disjoint difference We can also define a version of rectangle difference which returns a set of disjoint rectangles. The idea is this. Let the two

Disjoint difference
We can also define a version of rectangle difference which returns a set of disjoint rectangles. The idea is this. Let the two rectangles be R=(I1,dots,In) and S=(J1,dots,Jn), where I1,dots,In and J1,dots,Jn are the intervals forming the two rectangles R and S.
To compute the difference R??S as a list of disjoint rectangles, we reason by induction (thus writing a recursive solution). Consider the coordinate k=1.
Let I1-J1=A, so that A is a list consisting of 0,1, or 2 intervals. Cleady, for any interval LinA, we have that (L,I2,dots,In) is part of the result.
As for the remaining part of the result, let I1J1=H.H can be empty, or consist of one interval.
The rest of the result is given by
H,I2,dots,In??(J1,J2,dots,Jn)=H[I2,dots,In??(J2,dots,Jn)]
It is easier thus to define a generator, which yields all the rectangles in the difference.
Computation of disjoint difference
metitle Computation of disjoint difference
def disjoint_minus(r,s :
"un"R and S are equal-length lists of intervals, representing
two rectangles R and S. The function returns, or better, yields,
all the rectangles in the disjoint difference of R and S."w."
AIHI YOUR SOLUTION MERE
 Disjoint difference We can also define a version of rectangle difference

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!