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

Refactor vector3_t #1645 #1648

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Yogesh9000
Copy link
Contributor

refactored vector3_t and added a naive parse function

Copy link

github-actions bot commented Oct 5, 2024

You are modifying libf3d public API! ⚠️Please update bindings accordingly⚠️!
You can find them in their respective directories: python, java, webassembly.

Copy link

codecov bot commented Oct 5, 2024

Codecov Report

Attention: Patch coverage is 75.67568% with 9 lines in your changes missing coverage. Please review.

Project coverage is 96.80%. Comparing base (544ae70) to head (12ddb7b).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
library/public/types.h 75.67% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1648      +/-   ##
==========================================
- Coverage   96.85%   96.80%   -0.05%     
==========================================
  Files         108      104       -4     
  Lines        7691     7861     +170     
==========================================
+ Hits         7449     7610     +161     
- Misses        242      251       +9     

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

library/public/types.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
@@ -4,6 +4,10 @@
"type": "string",
"default_value": "+Y"
},
"up_direction2": {
Copy link
Contributor

Choose a reason for hiding this comment

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

please add a test in TestSDKOption.cxx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what am I supposed to here exactly. there doesn't seems to be test for other options in TestSDKOption.cxx

Copy link
Contributor

Choose a reason for hiding this comment

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

TestSDKOptions.cxx test all types of options, you are adding a new type of option, you should test it.

{
throw options::parsing_exception("cannot parse " + str + " to a vector3_t");
}
int sign = +1;
Copy link
Contributor

Choose a reason for hiding this comment

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

We do have a logic based on regex working there:

if (std::regex_match(upString, match, re))

Feel free to copy it.
The advantage is it supports lowercase, omitting the + prefix, and errors out if invalid.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Yogesh9000 please take this into account.

library/public/types.h Show resolved Hide resolved
library/testing/PseudoUnitTest.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
library/testing/TestSDKOptionsIO.cxx Outdated Show resolved Hide resolved
python/F3DPythonBindings.cxx Show resolved Hide resolved
library/public/types.h Outdated Show resolved Hide resolved
@Yogesh9000
Copy link
Contributor Author

@Meakk @mwestphal have you reviewed the changes fo this pr

*/
struct F3D_EXPORT point3_t : std::array<double, 3>
struct type_creation_exception : public exception
Copy link
Contributor

Choose a reason for hiding this comment

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

missing F3D_EXPORT I think

Value[0] = vec[0];
Value[1] = vec[1];
Value[2] = vec[2];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

all above should be covered by tests

{
os << "{ " << vec[0] << ", " << vec[1] << ", " << vec[2] << " }";
return os;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

above should be covered by tests

@@ -1,6 +1,7 @@
#ifndef PseudoUnitTest_h
#define PseudoUnitTest_h

#include "types.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure why this would be needed

Copy link
Contributor

Choose a reason for hiding this comment

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

I would assume it's to know about std::ostream& operator<<(std::ostream& os, const f3d::vector3_t& vec).

I think it would be better if it was not included from inside PseudoUnitTest.h (to keep that bit of code as "standalone" as possible) but I don't know if it's doable. Would it work to have #include "types.h" before #include "PseudoUnitTest.h" in TestSDKOptionsIO.cxx?

Copy link
Contributor

@mwestphal mwestphal left a comment

Choose a reason for hiding this comment

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

reviewed, some changes needed.

BTW you will need to try and replace up_direction2 into up_direction (and make the appropreiate changes) before being able to merge.
Please keep these changes into a separate commit for clarity.
If needed I can take over to do it, do not hesitate :)

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.

4 participants