Overlapping box with infinite edge coordinate

狂风中的少年 提交于 2019-12-11 19:46:42

问题


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?


回答1:


I asked on the postgresql buglist:

Tom lane gave me this answer :

The test for this involves

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

where FPge is defined as

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

When both high.x values are infinity, you have infinity minus infinity, which yields NaN in IEEE arithmetic, so the comparison to epsilon comes out false.

In general I don't think we promise that geometric operations involving infinite endpoints will behave sanely. There are probably a boatload of corner cases besides this one that'd need to be fixed before we could consider that a supported case.



来源:https://stackoverflow.com/questions/10642646/overlapping-box-with-infinite-edge-coordinate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!