-
Notifications
You must be signed in to change notification settings - Fork 400
Add ReciprocalArea #955
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
Add ReciprocalArea #955
Conversation
…h ReciprocalArea quantity.
…calArea quantity.
@bc913 I see the natural connection with ReciprocalLength and the wiki helps me see some value in adding this, but I am concerned about not adding too many inverse/reciprocal versions of quantities. How many more quantities do you expect to add reciprocal versions of? |
@angularsen I totally understand your concern about bloating the repo and I agree but based on my experiences throughout several engineering disciplines (naval architecture, aerospace and physics simulation), the usages of the reciprocal length and the reciprocal area quantities are not so uncommon. They are useful quantities to represent some direct or derived physical representations. The reciprocal angle can also be considered as part of my argument I mentioned above but I'm not planning to add it or any other reciprocal quantity in near future. The reciprocal area is the last reciprocal quantity I'd propose. No, volume is not a candidate. |
We should probably figure out a more generic way in the future. Perhaps a struct that wraps an IQuantity and can somehow invert the units automatically? We'd have to change a few things around rather than purely string based (probably an exponent per unit). But not to derail this PR :) |
var area = new Area(value, AreaUnit.SquareMeter); | ||
var inverseArea = area.Inverse(); | ||
|
||
AssertEx.Equals(expected, inverseArea.InverseSquareMeters); |
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.
I couldn't for the life of me understand why these tests passed.
Turns out AssertEx.Equals
does not exist, so this wound up calling System.Object.Equals()
and this naturally does not throw an assertion exception. 😄
Pushed a fix now.
Nuget is on the way out. By the way, #940 on inverse angle was closed earlier to avoid bloat, but I've since learned that reciprocal length/area/angle are maybe the most common ones worth adding so if you or the PR author wants to add it I'm happy to merge it. |
Added Reciprocal (Inverse) Area quantity and the corresponding units. Check this link for further info. It is also used in fluid dynamics.