Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf806c19

Browse files
committed
Simplify box_overlap computations.
Given the assumption that a box's high coordinates are not less than itslow coordinates, the tests in box_ov() are overly complicated and can bereduced to about half as much work. Since many other functions ingeo_ops.c rely on that assumption, there doesn't seem to be a good reasonnot to use it here.Per discussion of Alexander Korotkov's GiST fix, which was already usingthe simplified logic (in a non-fuzzy form, but the equivalence holds justas well for fuzzy).
1 parent3c29b19 commitf806c19

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

‎src/backend/utils/adt/geo_ops.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,10 @@ box_overlap(PG_FUNCTION_ARGS)
558558
staticbool
559559
box_ov(BOX*box1,BOX*box2)
560560
{
561-
return ((FPge(box1->high.x,box2->high.x)&&
562-
FPle(box1->low.x,box2->high.x))||
563-
(FPge(box2->high.x,box1->high.x)&&
564-
FPle(box2->low.x,box1->high.x)))
565-
&&
566-
((FPge(box1->high.y,box2->high.y)&&
567-
FPle(box1->low.y,box2->high.y))||
568-
(FPge(box2->high.y,box1->high.y)&&
569-
FPle(box2->low.y,box1->high.y)));
561+
return (FPle(box1->low.x,box2->high.x)&&
562+
FPle(box2->low.x,box1->high.x)&&
563+
FPle(box1->low.y,box2->high.y)&&
564+
FPle(box2->low.y,box1->high.y));
570565
}
571566

572567
/*box_left-is box1 strictly left of box2?

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp