0

I try to understand how does overlapping box with infinity works

Why does the following exemple doesn't work. It works fine except when i try to introduce two infinite values.

This exemple should return true.

SELECT box '((1,1),(infinity, 1))' && box '((2, 1),(infinity, 1))' AS overlap;
overlap 
---------
f

The two exemples below works

SELECT box '((1,1),(4, 1))' && box '((2, 1),(infinity, 1))' AS overlap;
overlap 
---------
t


SELECT box '((1,1),(4, 1))' && box '((2, 1),(5, 1))' AS overlap;
overlap
---------
t

So my question is : Is there something i'm doing wrong or that i don't understand?

4

1 回答 1

0

我在 postgresql buglist 上问过:

汤姆莱恩给了我这个答案:

对此的测试涉及

FPge(box1->high.x, box2->high.x)

其中 FPge 定义为

#define FPge(A,B)    ((B) - (A) <= EPSILON)

当两个 high.x 值都是无穷大时,你有无穷大减去无穷大,这在 IEEE 算术中产生 NaN,因此与 epsilon 的比较结果是错误的。

总的来说,我不认为我们保证涉及无限端点的几何运算会表现良好。除了这个之外,可能还有一大堆角落案例需要修复,然后我们才能将其视为受支持的案例。

于 2012-06-06T07:31:15.650 回答