-
Notifications
You must be signed in to change notification settings - Fork 382
Create Plane from Location #1912
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: master
Are you sure you want to change the base?
Create Plane from Location #1912
Conversation
Otherwise creating of Plane from tuple of int does not work anymore due to introduced @multimethod
Instead of just creating a temporary plane and rotating it
multimethod did not work, as that disallows keyword arguments for construction of Plane, which ruins many tests multidispatch works with keyword arguments, but looks horrible in docs Construction from class method just works.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1912 +/- ##
=======================================
Coverage 95.74% 95.75%
=======================================
Files 29 29
Lines 7827 7842 +15
Branches 1179 1179
=======================================
+ Hits 7494 7509 +15
Misses 192 192
Partials 141 141 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
self.origin = Vector(origin) | ||
|
||
@classmethod | ||
def fromLocation(cls, loc: "Location",) -> "Plane": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not an __init__
overload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see it in the description. I think we'd rather have an __init__
version.
Sphinx fix PRs are highly welcome ;). Probably it will require a custom plugin...
First of all: I love working with CQ, thank you for maintaining this library!
Plane supports conversion between local/global coordinate systems, and Location supports chaining coordinate-system offsets.
So I from time to time want to convert between them.
However, while there is a
Location.__init__
fromPlane
and aLocation.plane
property, I did not find an implementation of the opposite conversion.This PR adds this conversion from
Location
toPlane
.Some things I ask the reviewers to notice and possibly discuss:
@multimethod
onPlane.__init__
. But that then disallows passing keyword arguments to the constructor, and that is needed in existing code. Using@multidispatch
produces working code, but Sphinx docs do not support it. So I leftPlane.__init__
untouched and added aPlane.fromLocation
class-method.Location.plane
property I added is analogous toPlane.location
.Plane
and then runs through a chain of conversions Plane -> Location -> Plane -> Location. In the end, there are two Planes and two Locations, which have to be equal, respectively. This is asserted, along with origin and rotations of the first created Location.I'm excited about your feedback!