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

Const-qualify most of the methods in SAC model classes #2270

Merged
merged 2 commits into from
May 2, 2018

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Mar 29, 2018

SAC model objects are nearly stateless; most of their methods do not mutate model state. This pull request marks them as const.

taketwo added 2 commits March 29, 2018 10:12
This field is used only by OptimizationFunctor inside
optimizeModelCoefficients() function. Since it is logically local for
that function, the pointer to inliers vector is now passed directly to
OptimizationFunction.

Additionally, mark the pointer to self that is passed to
OptimizationFunctor as const, because the functor does not mutate the
state of the model.

After this patch the state of the SAC model is not mutated during the
optimizeModelCoefficients() call and this method may be marked as const.
* isModelValid()
* computeVariance()
* getRadiusLimits()
* getSamplesMaxDist()
* computeModelCoefficients()
* getDistancesToModel()
* projectPoints()
* estimateRigidTransformationSVD()
* pointToLineDistance()
* projectPointToLine()
* projectPointToCylinder()
* pointToAxisDistance()
* countWithinDistance()
* doSamplesVerifyModel()
* optimizeModelCoefficients()
@taketwo taketwo added needs: code review Specify why not closed/merged yet changelog: API break Meta-information for changelog generation labels Mar 29, 2018
@SergioRAgostinho SergioRAgostinho merged commit 6770ab3 into PointCloudLibrary:master May 2, 2018
@SergioRAgostinho SergioRAgostinho removed the needs: code review Specify why not closed/merged yet label May 2, 2018
@taketwo taketwo deleted the sac-const branch September 10, 2018 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: API break Meta-information for changelog generation module: sample_consensus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants