Re: Distance from point to box

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Distance from point to box
Date: 2014-07-30 16:42:02
Message-ID: CAPpHfduTyRr16G35-7PUdwe07795fekSR+USi_K5wSUyyeXeFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 30, 2014 at 7:26 PM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:

>
> ISTM that you miss the projection on the segment if dx=0 or dy=0.
>>>
>>
>> I don't need to find projection itself, I need only distance. When dx = 0
>> then nearest point is on horizontal line of box, so distance to it is dy.
>> Same when dy = 0. When both of them are 0 then point is in the box.
>>
>
> Indeed. I thought that the box sides where not parallel to the axis, but
> they are. So I do not see why it should be more complex. Maybe they is a
> general algorithm which works for polygons, and they use it for boxes?

Yeah, this answers question #1, but not #2 and #3 :)

------
With best regards,
Alexander Korotkov.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-07-30 17:24:59 Re: gaussian distribution pgbench -- splits v4
Previous Message Bruce Momjian 2014-07-30 16:07:50 Re: BUG #10823: Better REINDEX syntax.