Interface RectangleSetIntersectionAlgorithm
must be
implemented by algorithms that solve the rectangle-set intersection
problem. In this problem, the input consists of two sets of
rectangles. The goal is to find all pairs of rectangles (i,j)
where rectangle i is from the first set and rectangle j is
is from the second set. Thus, the return value is an array
whose length is the number of such intersections and whose
elements are pairs. Note that each input rectangle set is
an array of type IntRectangle
(a class for a
rectangle with integer coordinates). Each IntRectangle
instance has a unique ID. Thus if a rectangle with ID=5 intersects
with a rectangle with ID=12, then the algorithm should return
(5,12) as one of the pairs found. In order to return an array
of pairs, the class IntPair
is defined. Thus,
in this example, the i
field of the IntPair
instance should contain 5 and the j
field should
contain 12. The return value should be null
if
no intersections are found.
Algorithm
Method Summary | |
IntPair[] |
findIntersections(IntRectangle[] rectSet1,
IntRectangle[] rectSet2)
Method findIntersections is the only method in
the interface. |
Methods inherited from interface edu.gwu.algtest.Algorithm |
getName, setPropertyExtractor |
Method Detail |
public IntPair[] findIntersections(IntRectangle[] rectSet1, IntRectangle[] rectSet2)
findIntersections
is the only method in
the interface. The input parameters are two rectangle sets.
The output is an array of pairs, where each pair consists
of two ID's, one from each rectangle set. See the description
of the interface above for more details. NOTE: the return
value should be null
if no intersections are found.
rectSet1
- an IntRectangle[]
valuerectSet2
- an IntRectangle[]
valueIntPair[]
value