pybind: Add S1Angle bindings - #562
Conversation
|
@jmr, ready for you review. Not sure why the CI is failing |
|
@jmr, I believe I've addressed your comments! |
jmr
left a comment
There was a problem hiding this comment.
Sorry, I noticed a few more things.
|
|
||
| def test_repr(self): | ||
| a = s2.S1Angle.from_degrees(45.0) | ||
| self.assertEqual(repr(a), "S1Angle(45.0000000)") |
There was a problem hiding this comment.
hmm. add assertEqual(a, S1Angle(45.0000000)) here. I don't think we have a float constructor. Use from_degrees and ideally control the number of trailing 0s.
There was a problem hiding this comment.
Not quite sure if this addresses your comment, but added test variations that show the input precision doesn't affect the output precision (since that's controlled by the C++ implementation)
There was a problem hiding this comment.
I think we shouldn't be using the C++ operator here, but let's not block this PR any longer.
- Make radians/degrees/e5/e6/e7 properties instead of methods - Expose IsNormalized() and Normalize() - Replace std::to_string with absl::StrCat (locale safety) - Move sin/cos/tan from module-level functions to instance methods - Organize module.cc into dependency tranches with comments - Update README property rule
77385b2 to
34c27c7
Compare
|
@jmr, PTAL! |
# Conflicts: # src/python/s1interval_bindings.cc
jmr
left a comment
There was a problem hiding this comment.
Good except for the extra #include.
Add pybind11 bindings for S1Angle.
Also add S1Angle::IsNormalizedAngle() to s1angle.h for pre-validating
E5/E6/E7 conversions.
Supports downstream PRs for S2LatLng (deustis#2) and
S2CellId (deustis#3).
(Part of a series of addressing #524)