Comments (4)
One could argue that the boundary of a region is not completely contained by that region (per the ContainsCell
docs on the Region
interface), so the behaviour of that method on s2.Loop
and s2.Polygon
is reasonable. I can see how the reflexive predicate is a special case here.
I just eyeballed the Go code in parallel with the C++ code, and they look equivalent, so I might guess that the C++ code has the same behaviour. If that's the case (care to check?), then we won't change Go unless C++ changes first (consider Go to be a downstream port of the C++).
@jmr might have thoughts.
from geo.
The same thing happens in C++, at least for the cell id I picked.
I think the comment on the C++ S2Loop(S2Cell) constructor explains what's going on for the loop and polygon.
// Construct a loop corresponding to the given cell.
//
// Note that the loop and cell *do not* contain exactly the same set of
// points, because S2Loop and S2Cell have slightly different definitions of
// point containment. For example, an S2Cell vertex is contained by all
// four neighboring S2Cells, but it is contained by exactly one of four
// S2Loops constructed from those cells. As another example, the S2Cell
// coverings of "cell" and "S2Loop(cell)" will be different, because the
// loop contains points on its boundary that actually belong to other cells
// (i.e., the covering will include a layer of neighboring cells).
explicit S2Loop(const S2Cell& cell);
The class level loop comments explain why.
// Point containment of loops is defined such that if the sphere is subdivided
// into faces (loops), every point is contained by exactly one face. This
// implies that loops do not necessarily contain their vertices.
//
// Note: The reason that duplicate vertices and intersecting edges are not
// allowed is that they make it harder to define and implement loop
// relationships, e.g. whether one loop contains another. If your data does
// not satisfy these restrictions, you can use S2Builder to normalize it.
What documentation of Region
says the calls should all return the same result?
@ericveach may have more to add.
from geo.
Jesse's explanation is correct. And yes, there is no requirement that the Region::ContainsCell() should return the same result for "cell" and S2.LoopFromCell(cell), because those two regions are not the same.
from geo.
Thanks guys. It sounds like this is working as intended, just slightly non-obvious.
from geo.
Related Issues (20)
- Calculate S2 of polygon with OOM Error in golang
- AllNeighbors has a bug
- PolygonBuilder HOT 2
- Invalid input loops to PolygonFromOrientedLoops HOT 2
- Having trouble with RegionCoverer
- Loop.Area() unit HOT 1
- Find Closest Edge Performance with Many Polylines
- Porting bug
- Bug on Polygon Contains (linked to https://github.com/golang/geo/issues/77 ?) HOT 1
- High memory usage in getting s2 cell covering HOT 3
- Polygon.Intersects() method not working for some inputs? HOT 1
- golang-s2 momory leak HOT 1
- Q: How do you calculate the distance in km between 2 lat/lng points? HOT 7
- ppc64le - TestPredicatesRobustSignEqualities failure due to floating point precision differences HOT 1
- ppc64le - TestPointMeasuresPointArea failure due to floating point precision differences
- ppc64le - TestClosestEdgeQueryTrueDistanceLessThanChordAngleDistance failure due to floating point precision differences HOT 1
- Inverted params HOT 1
- Get a random point from a shape HOT 2
- Subdivide polygon
- Memory Leak when a loop contains point multiple time HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geo.