Skip to content

Commit

Permalink
Use scoped enum for RegistrationMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
dsieger committed Aug 28, 2022
1 parent 5901b46 commit b971920
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
15 changes: 7 additions & 8 deletions src/pmp/algorithms/PointRegistration.cpp
Expand Up @@ -6,8 +6,7 @@
namespace pmp {

mat4 registration(const std::vector<Point>& _src,
const std::vector<Point>& _dst,
Registration_method _mapping,
const std::vector<Point>& _dst, RegistrationMethod _mapping,
const std::vector<Scalar>* _weights)
{
assert(_src.size() == _dst.size());
Expand Down Expand Up @@ -157,11 +156,11 @@ mat4 registration(const std::vector<Point>& _src,
{
int imax = 0;
double ss = M(imax, imax);
for (int i=1; i<4; ++i)
for (int i = 1; i < 4; ++i)
{
if (M(i,i) > ss)
if (M(i, i) > ss)
{
ss = M(i,i);
ss = M(i, i);
imax = i;
}
}
Expand All @@ -188,7 +187,7 @@ mat4 registration(const std::vector<Point>& _src,
T(3, 2) = 0.0;

// scaling
if (_mapping == SIMILARITY_REGISTRATION)
if (_mapping == RegistrationMethod::SIMILARITY)
{
Point sp, dp;
Scalar nom(0), denom(0);
Expand Down Expand Up @@ -229,7 +228,7 @@ mat4 registration(const std::vector<Point>& _src,

mat4 registration_l1(const std::vector<Point>& _src,
const std::vector<Point>& _dst,
Registration_method _mapping)
RegistrationMethod _mapping)
{
mat4 result;

Expand Down Expand Up @@ -265,7 +264,7 @@ mat4 registration_l1(const std::vector<Point>& _src,

for (int i = 0; i < n; ++i)
{
weights[i] = std::min( Scalar(10000), max_l2_error / l2_errors[i] );
weights[i] = std::min(Scalar(10000), max_l2_error / l2_errors[i]);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/pmp/algorithms/PointRegistration.h
Expand Up @@ -13,10 +13,10 @@ namespace pmp {

//! The two registration methods: Rigid registration optimizes for
//! rotation and translation, similarity registration additionally for scaling.
enum Registration_method
enum class RegistrationMethod
{
RIGID_REGISTRATION,
SIMILARITY_REGISTRATION
RIGID,
SIMILARITY
};

//! Compute the rigid or similarity transform that best maps
Expand All @@ -26,7 +26,7 @@ enum Registration_method
//! \details See \cite sumner_2004_deftrans and \cite botsch_2006_deftrans for details.
mat4 registration(const std::vector<Point>& _src,
const std::vector<Point>& _dst,
Registration_method _mapping = RIGID_REGISTRATION,
RegistrationMethod _mapping = RegistrationMethod::RIGID,
const std::vector<Scalar>* _weights = nullptr);

//! Compute the rigid or similarity transform that best maps
Expand All @@ -35,7 +35,7 @@ mat4 registration(const std::vector<Point>& _src,
//! \details See \cite bouaziz_2013_sparse for details. This implementation uses iteratively reweighted least squares.
mat4 registration_l1(const std::vector<Point>& _src,
const std::vector<Point>& _dst,
Registration_method _mapping = RIGID_REGISTRATION);
RegistrationMethod _mapping = RegistrationMethod::RIGID);

//! @}

Expand Down

0 comments on commit b971920

Please sign in to comment.