Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest

2018-12-01 Thread Graham Hardman
oh, I hope you dont do that since the application I am working on hopes 
to exploit the retval = 4 of geopoly_overlap !


regards,
Graham

On 02-12-2018 7:52 am, Richard Hipp wrote:

On 12/1/18, Larry Brasfield  wrote:

The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for
geopoly_contains_point(), asserts that the function “returns true if 
and
only if the coordinate X,Y is inside or on the boundary of the polygon 
P.”
As now implemented, in the v3.26 release, it returns 1 where the point 
is on

a boundary and 2 where the point is inside of the boundary.


The geopoly_overlap() and geopoly_within() routines are similarly
modest about what they compute.  Geopoly_within(A,B) returns +1 if B
is completely contained inside of A, and returns +2 if A and B are the
same polygon.  Geopoly_overlap(A,B) returns 4 different non-zero
values (1, 2, 3, and 4) depending on whether or not A is contained in
B (2), B is contained in A (3), A and B are the same polygon (4), or
if they just overlap (1).

I haven't documented those behaviors, because I wanted to leave myself
some wiggle room in case I need to change the behavior in the future.

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest

2018-12-01 Thread Richard Hipp
On 12/1/18, Keith Medcalf  wrote:
>
>>Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than
>>true, since true, as a symbol, as a special value.
>
> Yes and no, True and False is SQLite work as one would expect (assuming that
> one is a programmer is a language that behaves as the underlying hardware
> (CPU) behaves).

Yeah, but Mr. Damon is probably right that the documentation should be
more precise.  So I have now updated it.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest

2018-12-01 Thread Keith Medcalf

>Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than
>true, since true, as a symbol, as a special value.

Yes and no, True and False is SQLite work as one would expect (assuming that 
one is a programmer is a language that behaves as the underlying hardware (CPU) 
behaves).  The "False" state is any state in which all the bits are zero.  The 
"True" state is one in which ANY bit is non-zero.

Therefore you get:

sqlite> select -1 is true;
1
sqlite> select 0 is true;
0
sqlite> select 1 is true;
1
sqlite> select 2 is true;
1

and conversely for "is false".  You can also treat True and False as "values" 
in which case True has the arbitrary integer value 1, and false has the 
arbitrary integer value 0 (which complies with the "True means ANY bit is 1 and 
false means NO bits are one".  Any arbitrary non-zero value could have been 
chosen for the "value" of True when it is used as a value.

Using the expression "= TRUE" and "= FALSE" is likely a programmer error, just 
as "= NULL" is likely a programmer error, because what is really meant is "is 
TRUE", "is FALSE" and "is NULL" ...

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest

2018-12-01 Thread Richard Damon
On 12/1/18 1:52 PM, Richard Hipp wrote:
> On 12/1/18, Larry Brasfield  wrote:
>> The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for
>> geopoly_contains_point(), asserts that the function “returns true if and
>> only if the coordinate X,Y is inside or on the boundary of the polygon P.”
>> As now implemented, in the v3.26 release, it returns 1 where the point is on
>> a boundary and 2 where the point is inside of the boundary.
> The geopoly_overlap() and geopoly_within() routines are similarly
> modest about what they compute.  Geopoly_within(A,B) returns +1 if B
> is completely contained inside of A, and returns +2 if A and B are the
> same polygon.  Geopoly_overlap(A,B) returns 4 different non-zero
> values (1, 2, 3, and 4) depending on whether or not A is contained in
> B (2), B is contained in A (3), A and B are the same polygon (4), or
> if they just overlap (1).
>
> I haven't documented those behaviors, because I wanted to leave myself
> some wiggle room in case I need to change the behavior in the future.

Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than true,
since true, as a symbol, as a special value.

-- 
Richard Damon

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest

2018-12-01 Thread Richard Hipp
On 12/1/18, Larry Brasfield  wrote:
> The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for
> geopoly_contains_point(), asserts that the function “returns true if and
> only if the coordinate X,Y is inside or on the boundary of the polygon P.”
> As now implemented, in the v3.26 release, it returns 1 where the point is on
> a boundary and 2 where the point is inside of the boundary.

The geopoly_overlap() and geopoly_within() routines are similarly
modest about what they compute.  Geopoly_within(A,B) returns +1 if B
is completely contained inside of A, and returns +2 if A and B are the
same polygon.  Geopoly_overlap(A,B) returns 4 different non-zero
values (1, 2, 3, and 4) depending on whether or not A is contained in
B (2), B is contained in A (3), A and B are the same polygon (4), or
if they just overlap (1).

I haven't documented those behaviors, because I wanted to leave myself
some wiggle room in case I need to change the behavior in the future.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users