rafaqz / Extents.jl

A shared Extent object for Julia spatial data, with DE-9IM spatial predicates
MIT License
4 stars 3 forks source link

use of the word "points" in docstrings is confusing #21

Closed alex-s-gardner closed 9 months ago

alex-s-gardner commented 9 months ago

Reading the method docstrings I get confused buy the use of the word "point" for Extents that areas defined by 4 edges

For example the intersects:

"a intersects b if a and b have at least one point in common "

the use of the word "point" implies some form of discretization but Extents are continuous within their limits with not points to compare. I know this may sound like semantics but I continually get confused but this whenever I need to refer back to the methods docs. Would it be better to describe Extents in terms of regions and edges?

"a intersects b if both share a common region or edge"

I'm happy to make a PR but want to make sure we're in agreement before I do.

rafaqz commented 9 months ago

The text is mostly lifted or slightly modified from the DE-9IM standard: https://en.wikipedia.org/wiki/DE-9IM

The reason to use point is that we are often actualy talking about a discrete point: the intersection of two corners is a point. So "at least one point in common" means at least the corners touch (everything after that is infinite points, true).

Shared edges are rarely relevent, because specifying the point case is enough. Regions are also a different thing entirely. Internal space inside the bounding box is not the same as corners or edges.

alex-s-gardner commented 9 months ago

"The reason to use point is that we are often actualy talking about a discrete point", this is exactly the reason for the confusion. Sometimes "points" refers to a point and sometimes it refers to vertices and sometimes it refers to Regions.

for a = Extent(X = (0, 1), Y = (0,1)) b = Extent(X = (0.5, 1.5), Y = (0.5,1.5))

a and b share no common "points/corners" and yet

Extents.intersects(a, b) = true

rafaqz commented 9 months ago

Its true because they share infinite points in their interiors, and also infinite points on the edges that cross each others interiors?

Infinite satisfies "at least one"!

The language is to distinguish the limiting case where e.g. the corner touches. Theses limiting cases are actually the most important things to specify in the logic of the algorithms, and mostly take care of all the other cases. After going through the process of writing them incorrectly the first time, that is glaringly apparent to me.

Besides, I didn't make this up, I am but the messenger for a widely used component of the OGC standards, faithfully replicating their language to avoid any personal ownership of it ;)

alex-s-gardner commented 9 months ago

I spent more time reading https://en.wikipedia.org/wiki/DE-9IM and I certainly can't fault you for the language, as unintuitive as it might be.

rafaqz commented 9 months ago

I put the wikipedia link to it in every single docstring expecting exactly this discussion! because, yes, the language is hard to get your head around, I think I spent a whole day at it.