1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# IR_OVERLAP -- Procedure to compute the overlap between two rectangles.
int procedure ir_overlap (pc1out, pc2out, pl1out, pl2out, c1out, c2out,
l1out, l2out, oc1out, oc2out, ol1out, ol2out)
int pc1out, pc2out # previous subraster column limits
int pl1out, pl2out # previous subraster line limits
int c1out, c2out # current subraster column limits
int l1out, l2out # current subraster line limits
int oc1out, oc2out # overlap column limits
int ol1out, ol2out # overlap line limits
begin
# Check for the case where no intersection is present.
if (c1out > pc2out || c2out < pc1out || l1out > pl2out ||
l2out < pl1out)
return (NO)
# Compute the column overlap limits.
if (pc1out <= c1out)
oc1out = c1out
else
oc1out = pc1out
if (pc2out <= c2out)
oc2out = pc2out
else
oc2out = c2out
# Compute the line overlap limits.
if (pl1out <= l1out)
ol1out = l1out
else
ol1out = pl1out
if (pl2out <= l2out)
ol2out = pl2out
else
ol2out = l2out
return (YES)
end
|