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

Add matrix of inertia #1460

Merged
merged 6 commits into from
Jan 2, 2024
Merged

Conversation

kmarchais
Copy link
Contributor

@kmarchais kmarchais commented Dec 11, 2023

This pull request introduces the implementation of the inertia matrix.
As indicated in issue #1453, this functionality is already accessible in OCP.

  • The implementation returns the inertia matrix in the form of a List[List[float]].
  • Additionally, a corresponding test has been developed by calculating the inertia matrix for a cylinder and validating it against the theoretical value.

This is my first PR here, I will be happy to have any suggestion to improve the code changes.
Apparently the tests are failing (even on master for me) on tests/test_cadquery.py::TestCadQuery::testSweep.

@adam-urbanczyk
Copy link
Member

Could you run black form this repo https://github.com/CadQuery/black (or 19.10b0) on your changes?

@kmarchais
Copy link
Contributor Author

Sorry about the different formatting style, it should be better now

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (79e64e5) 94.35% compared to head (8ee2e58) 94.42%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1460      +/-   ##
==========================================
+ Coverage   94.35%   94.42%   +0.07%     
==========================================
  Files          28       28              
  Lines        5809     5778      -31     
  Branches      993      983      -10     
==========================================
- Hits         5481     5456      -25     
+ Misses        197      194       -3     
+ Partials      131      128       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kmarchais
Copy link
Contributor Author

kmarchais commented Dec 16, 2023

The test has been updated.

The implementation of matrixOfInertia has been inspired by the centerOfMass and computeMass methods, which, if I am not mistaken, have not been tested. Should this pull request include tests for these methods as well?

Copy link
Member

@jmwright jmwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kmarchais

@jmwright jmwright merged commit d1a3a92 into CadQuery:master Jan 2, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants