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 GeomAPI_PointsToBSpline as an optional alternative algorithm in CSTCurveBuilder #1049

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

joergbrech
Copy link
Contributor

@joergbrech joergbrech commented Jan 10, 2025

Fixes #1048

Description

This PR adds the option to set the algorithm in CCSTCurveBuilder. The current algorithm based on a Chebychev approximation creates relatively good curves with few control points, but it potentially introduces discontinuities in the curvature, because the approximation is performed segmentwise and the segments are concatenated without taking second derivatives into account.

With the changes introduced here, the CCSTCurveBuilder constructor gets a new optional enum argument, to switch the algorithm to OCCT's GeomAPI_PointsToBSpline implementation for the approximation. This results in a C3 continuous B-Spline of degree 4 which is much smoother, but may have more control points.

How Has This Been Tested?

The existing CSTApprox tests have been parametrized, such that the both algorithms are tested. In addition, the profile definition from the issue description in #1048 has been added. As it turns out, the old implementation fails to satisfy the prescribed tolerance of 1e-5 for this specific choice of CST parameters.

grafik
The image shows the curvature comb for the Chebychev approximation (default algorithm that was used thus far) to the right in the back and the curvature comb for the approximation based on GeomAPI_PointsToBSpline to the left/front.

Checklist:

Task Finished Reviewer Approved
At least one test for the new functionality was added.
  • yes
  • does not apply
  • OK
New classes have been added to the Python interface.
  • yes
  • does not apply
  • OK
The code is properly documented with doxygen docstrings
  • yes
  • does not apply
  • OK
Changes are documented at the top of ChangeLog.md
  • yes
  • does not apply
  • OK

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.50%. Comparing base (23808d7) to head (9b3964f).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/geometry/CCSTCurveBuilder.cpp 95.45% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1049      +/-   ##
==========================================
+ Coverage   69.48%   69.50%   +0.01%     
==========================================
  Files         301      301              
  Lines       26894    26912      +18     
==========================================
+ Hits        18688    18705      +17     
- Misses       8206     8207       +1     
Flag Coverage Δ
unittests 69.50% <95.45%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/geometry/CCSTCurveBuilder.cpp 96.15% <95.45%> (-0.91%) ⬇️

@AntonReiswich
Copy link
Contributor

AntonReiswich commented Jan 13, 2025

I somehow can not tick the boxes in the checklist? ( In the Reviewer approved column)
Is it supposed to be like this?

@joergbrech
Copy link
Contributor Author

I somehow can not tick the boxes in the checklist? ( In the Reviewer approved column)
Is it supposed to be like this?

Yeah, it doesn't work. You have to edit the PR message and modify the raw markdown. Unfortunately GH does not support checklists in tables very well.

@AntonReiswich
Copy link
Contributor

I see. Ok, that also works. done.

@AntonReiswich AntonReiswich merged commit 5f41a2d into master Jan 14, 2025
17 checks passed
@AntonReiswich AntonReiswich deleted the 1048-cstcurvebuilder-pointtobspline branch January 14, 2025 08:40
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.

The CCSTCurveBuilder generates curves with small discontinuities in the curvature
2 participants