Re: [PATCH] Add overlaps geometric operators that ignore point overlaps - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: [PATCH] Add overlaps geometric operators that ignore point overlaps
Date
Msg-id 20230111.111343.2300963197830746672.horikyota.ntt@gmail.com
Whole thread Raw
In response to [PATCH] Add overlaps geometric operators that ignore point overlaps  (Ankit Kumar Pandey <itsankitkp@gmail.com>)
List pgsql-hackers
Hello.

At Sun, 1 Jan 2023 01:13:24 +0530, Ankit Kumar Pandey <itsankitkp@gmail.com> wrote in 
> This is patch for todo item: Add overlaps geometric operators that
> ignore point overlaps
> 
> Issue:
> 
> SELECT circle '((0,0), 1)' && circle '((2,0),1) returns True
> 
> Expectation: In above case, both figures touch other but do not
> overlap (i.e. touching != overlap). Hence, it should return false.

This may be slightly off from the common definition in other geometric
processing systems, it is the established behavior of PostgreSQL that
should already have users.

About the behavior itself, since it seems to me that the words "touch"
and "overlap" have no rigorous mathematical definitions, that depends
on definition. The following discussion would be mere a word play..

If circle ((0,0),1) means a circumference, i.e. a set of points
described as "x^2 + y^2 = 1" (or it may be a disc containing the area
inside (<=) here) and "overlap" means "share at least a point", the
two circles are overlapping. This seems to be our current stand point
and what is expressed in the doc.

If it meant the area exclusively inside the outline (i.e. x^2 + y^2 <
1), the two circles could be said touching but not overlapping.  Or,
if circle is defined as "(<)= 1" but "overlap" meant "share at least
an area", they could be said not overlapping but touching? (I'm not
sure about the border between a point and an area here and the
distinction would be connected with the annoying EPSILON..)  The same
discussion holds for boxes or other shapes.

> Now, as per as discussion
> (https://www.postgresql.org/message-id/20100322175532.GG26428%40fetter.org)
> and corresponding change in docs,
> https://www.postgresql.org/docs/15/functions-geometry.html, it
> mentions
> 
> `Do these objects overlap? (One point in common makes this true.)
> `. Does this means current behavior is correct? Or do we still need
> the proposed change (if so, with proper updates in docs)?
> 
> If current behavior is correct, this todo item might need some update
> (unless I missed anything) otherwise any suggestion is welcomed.

I read the todo description as we may want *another set* of operators
to do that, not to change the current behavior of the existing
operators.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL
Next
From: Amit Kapila
Date:
Subject: Re: Handle infinite recursion in logical replication setup