Skip to content

Small area flow compensator improvements#11716

Merged
igiannakas merged 5 commits into
OrcaSlicer:mainfrom
ianalexis:small-area-flow-compensation-interpolation
Dec 30, 2025
Merged

Small area flow compensator improvements#11716
igiannakas merged 5 commits into
OrcaSlicer:mainfrom
ianalexis:small-area-flow-compensation-interpolation

Conversation

@ianalexis

@ianalexis ianalexis commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

Closes #11590

Description

PchipInterpolator

Swapped out the tk::spline implementation for PchipInterpolatorHelper in SmallAreaInfillFlowCompensator. Updated member types and method calls to use the new interpolator for improved flow compensation modeling.

Two near values can create a spike in the estimation:
imagen

With Pchip it will create a better interpolation
imagen

Throw error

Currently, when there is an error in a value, it fails silently and does not slice normally, which can give a false impression that it is working when it is not. Now the message is displayed and the slice is stopped.

Strictly increasing flow compensation factors

Added a check to ensure that flow compensation factors in SmallAreaInfillFlowCompensator strictly increase with extrusion length, throwing an exception if this condition is not met. This improves input validation and prevents invalid compensation models.

@ianalexis ianalexis changed the title Replace spline with PchipInterpolatorHelper in flow compensator Small area flow compensator improvements Dec 23, 2025
@ianalexis ianalexis force-pushed the small-area-flow-compensation-interpolation branch from 93b9769 to 5f17d44 Compare December 23, 2025 15:32
@ianalexis ianalexis marked this pull request as ready for review December 23, 2025 15:32
@igiannakas

Copy link
Copy Markdown
Collaborator

That’s interesting! The zero delta E of the PCHIP interpolation vs given values is a good use case to ensure model adherence.

Will need to test with some users at the discord as it may require a slight model change (as the curve will be different).

@ianalexis

ianalexis commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator Author

Will need to test with some users at the discord as it may require a slight model change (as the curve will be different).

Yes, but I am 99.99% sure that this will change practically nothing, except that it will correct those cases with erroneous estimates.
Besides, it is still a feature that is in “beta,” so I don't think an improvement like this will have much of an impact.

@igiannakas

Copy link
Copy Markdown
Collaborator

Agreed. Btw if we remove the spline use, I think the spline header file can be removed completely - I don't think its used elsewhere as it was introduced with the original PR. https://github.com/OrcaSlicer/OrcaSlicer/pull/3334/files

@ianalexis ianalexis force-pushed the small-area-flow-compensation-interpolation branch from 4ac08c5 to ecc5f0f Compare December 24, 2025 12:25
@ianalexis

Copy link
Copy Markdown
Collaborator Author

Agreed. Btw if we remove the spline use, I think the spline header file can be removed completely - I don't think its used elsewhere as it was introduced with the original PR. https://github.com/OrcaSlicer/OrcaSlicer/pull/3334/files

Removed

Swapped out the tk::spline implementation for PchipInterpolatorHelper in SmallAreaInfillFlowCompensator. Updated member types and method calls to use the new interpolator for improved flow compensation modeling.
Added a check to ensure that flow compensation factors in SmallAreaInfillFlowCompensator strictly increase with extrusion length, throwing an exception if this condition is not met. This improves input validation and prevents invalid compensation models.
Prefixed error messages in SmallAreaInfillFlowCompensator with 'Small Area Flow Compensation' for improved clarity and debugging. Also rethrows exceptions after logging to ensure proper error propagation.
Eliminated the spline header-only library from the project by deleting its CMake configuration and header file, and updating documentation and build scripts to remove references to spline. This streamlines the dependencies and build process.
@ianalexis ianalexis force-pushed the small-area-flow-compensation-interpolation branch from ecc5f0f to 53d1fb2 Compare December 29, 2025 13:58
@igiannakas

Copy link
Copy Markdown
Collaborator

Reviewed. Indeed this is a very good use of the PCHIP interpolator already in the code base by adaptive PA, as it guarantees zero delta-E between set points and does not overshoot like spline/cubic can do.

Merging for wider nightly testing.

@igiannakas igiannakas merged commit 81dd153 into OrcaSlicer:main Dec 30, 2025
5 checks passed
@ianalexis ianalexis deleted the small-area-flow-compensation-interpolation branch December 30, 2025 13:41
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.

Linear interpolation in Small area flow compensation

2 participants