Alexander Korotkov <aekorotkov@gmail.com> writes:
> On Sat, Nov 3, 2012 at 4:23 AM, Noah Misch <noah@leadboat.com> wrote:
>> ... At internal pages, gist_point_consistent() should implement
>> "point <@ box" with an algorithm near-equivalent to box_overlap(). (As an
>> optional deviation, it may use exact comparisons despite box_overlap() using
>> fuzzy comparisons.) Looking at the math again, your latest code does achieve
>> that, too. I was thrown off by your use of a different, albeit mathematically
>> equivalent, algorithm from the one used in box_overlap(). Please don't do
>> that; either use box_overlap()'s algorithm here, or change box_overlap() to
>> use the shorter algorithm you have introduced. Formulating the same
>> calculation differently in related code is a recipe for confusion. (Then
>> again, perhaps the equivalence of the algorithms is obvious to everyone
>> entitled to travel within 1 km of the geometric type implementation.)
> I've added comment for clarifying this situation.
Applied and back-patched with some cosmetic changes (mostly the
comments) and a better version of the regression test.
As a separate commit, I also simplified box_overlap() to match this
logic, since I agree with Noah that it's not good for them to look so
different. Besides, it should be at least a bit faster this way.
regards, tom lane