Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon support #7

Open
olanod opened this issue Oct 15, 2019 · 2 comments
Open

Polygon support #7

olanod opened this issue Oct 15, 2019 · 2 comments

Comments

@olanod
Copy link

olanod commented Oct 15, 2019

Hi! nice work this S2 port has been useful :) Do you have any road maps or plans on how to implement the missing features? I'm no expert but maybe with some guidance I could give a hand? would it be a big effort to do polygons?

@yjh0502
Copy link
Owner

yjh0502 commented Oct 16, 2019

@olanod Hi! I'm not actively working to make this library feature-parity with c++ or java version, and that's same with Golang port [1]. My primary interest was on RegionCoverer and fast point indexing /distance query (center and radius), so the port is focused on the functionality.
The rust port is based on Golang port, so rust port follows naming conventions and file structures of Golang port. If a feature you need is already implemented in Golang port, you can port it to the rust with moderate effort. Here's my process.

with given feature/API you need,

  • find API from Golang port and copy it to rust codebase, and comment it [2]
  • write a small testcase that uses the API
  • convert code to rust mechanically, function by function, until the TC compiles & passes
    • preserve all comments from Golang port for reference
    • try to preserve function name from Golang is possible to make it easy to follow upstream
    • try to write idiomatic rust, for example func CapFromPoint(p Point) Cap to impl From<&'a Point> for Cap

Following commit might be helpful to show the process: 68f636a

[1] You can check unimplemented features on Golang code. https://github.com/golang/geo/blob/master/s2/polygon.go#L1186-L1212.
[2] https://github.com/yjh0502/rust-s2/blob/master/src/s2/metric.rs#L195-L269

@alkeryn
Copy link

alkeryn commented Jan 15, 2023

@yjh0502 i could look into adding that feature in the future if i have some time, but does your go implementation supports multiple polygons at once ? :)
thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants