-
Notifications
You must be signed in to change notification settings - Fork 57
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
Adding custom reference axis projections #168
Conversation
Codecov Report
@@ Coverage Diff @@
## main #168 +/- ##
==========================================
- Coverage 64.05% 63.30% -0.75%
==========================================
Files 47 47
Lines 11814 11866 +52
==========================================
- Hits 7567 7512 -55
- Misses 4247 4354 +107
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 tried this out on my case because my wing has some dihedral. The method works as described. I left some comments on the implementation and documentation. Please also fix the black formatting.
One other thing is that the PR description says the normal for the wing FFD is in the y-direction. Shouldn't it be the z-direction?
Thanks a lot for the review @sseraj. I addressed all of your comments, including the update in the PR description. Please let me know if there are anything else I need to fix in here. |
Sorry for my late review. I am still going through the code, but at a first "deeper" look I think that the current |
That type of behavior change happens elsewhere in the code, and I added type checking explicitly for this. The problem with having multiple options that doe the same thing is then it is not clear at all which one takes precedence. |
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 understand the issue with multiple options. I still think this is not ideal but I am fine with it, and the docstring (+ the checks) is clear enough.
I only have an additional minor comment on a docstring.
Nice work, imho this is more intuitive than the default ray projection method.
I will merge this once the tests pass. I want to see them run because we changed the pyspline code in the meanwhile. Thanks to @sseraj and @marcomangano for the reviews. And codecov passes for once how about that! |
Purpose
The
axis
parameter when adding a reference axis determines how the links are created between each control point and the reference axis. The previous behavior only created rays from the control points and found the closest point between the ray and the reference axis to create the link from the control point to the reference axis.This approach cannot guarantee that the links will lie on the same plane a section of the FFD cross section lies. To demonstrate this, consider a wing FFD that also has some dihedral built into it. The default axis direction is
x
so the code creates rays in the x direction from all control points. Then it finds the closest point from the ref axis to the ray. Due to the dihedral, the points on the upper surface will map slightly outboard, while the points on the lower surface will map inboard. See figure that demonstrates this default behavior:In this PR, I add the capability to create the links based on the intersection of a plane and the reference axis. The plane for each control point is defined by the control point itself and a user supplied normal. The normal is handled through the axis parameter, and the code determines behavior based on the type of the input.
With the example above, if we set the axis parameter to
np.array([0.0, 0.0, 1.0)]
, the code creates a plane for each control point with the normal pointing in the z direction. Then, the reference axis links are created using the intersection of these planes with the reference axis. As a result, the control point links lie in the same plane at each section as shown here:I also added a test for this case. I add the ref axis to one of the example rectangular FFDs under the testing files with the axis direction [0, 1, 1]. The resulting links look like this:
The code then tests the vectors that define the links.
Expected time until merged
Less than a week hopefully. This is a fairly complete feature with an associated test.
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable