-
Notifications
You must be signed in to change notification settings - Fork 237
Rhumb no longer goes past pole #1153
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
base: main
Are you sure you want to change the base?
Conversation
|
I don't have review powers in this repo, but my two cents: one result of this change is that the rhumb-line intermediate and intermediate-fill operations might now panic given some float inputs. I think that's probably undesirable/surprising, and we'd be better off either with propagating this API change across to those methods as well, or clamping (either just for those or in general). You could consider returning an (I suppose another option would be |
|
I am happy to add checks that both inputs are between -90 and 90. There is no other scenario that will make any of the methods fail that I'm aware of. |
|
For sure, agreed that that's the circumstance where it matters. I think implementation isn't that important (do we check up front for -90 < x < 90 or do we just wait until the destination operation returns
|
Happy to assign you once you accept the org invite! |
d413d3e to
b57059d
Compare
|
I attempted to add clamping, but realized that it may be impractical. I left the broken commit with a unit test that illustrates the issue in. Basically, clamping to exactly +/-90 will make the actual point invalid and the intermediate longitudes will (correctly) be set to NaN. The alternatives are adding/subtracting epsilon to the clamp, which I think is a bad idea, or returning an
|
|
@joe-saronic sorry for the delay. Yes, I think you make a good case that clamping doesn't make sense here.
That makes sense, but I don't think the mechanism for refusing should be to panic. It's user error, but needn't be unrecoverable user error. I think Result or Option would be more appropriate here. And yeah, @urschrei accepted the invite, thanks! |
|
@apendleton I will update the PR shortly. |
b57059d to
af50f59
Compare
|
Sorry that this sat here so long. As I understand this PR, it's trying to validate that its input is in a valid range. Helping people do the right thing is good, but optionals tend to be contagious and can suddenly make a lot of API's more verbose, so there's a cost associated with changing them. We have a similar issue with Haversine - which assumes LngLat points, but does nothing to validate that they are actually valid. In the meanwhile, many of the line_measure traits have been reformulated under a set of traits in the Another option, would be to leave the "unchecked" apis as they are, and have a higher level more verbose API for people who want the algorithm to validate their input, and have some kind of method that does Somewhat relatedly, I never ported VincentyDistance to the new line_measures regime in part because it's fallible. I suspect it's similarly possible by parameterizing an output type, but due to inter-trait dependencies, there may be knock-on effects that require updating more than just one trait. I'm not confident enough that this would be a net win to invest my own time in hammering out a prototype, but if someone else wants to give it a go, I would review. |
CHANGES.mdif knowledge of this change could be valuable to users.Fixes #1152