Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
PhiBabin committed Oct 9, 2018
1 parent c778f90 commit 660a72b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions pointmatcher/OutlierFiltersImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ typename PointMatcher<T>::OutlierWeights OutlierFiltersImpl<T>::RobustOutlierFil

template<typename T>
typename PointMatcher<T>::Matrix
OutlierFiltersImpl<T>::RobustOutlierFilter::computePointToPlanDistance(
OutlierFiltersImpl<T>::RobustOutlierFilter::computePointToPlaneDistance(
const DataPoints& reading,
const DataPoints& reference,
const Matches& input) {
Expand Down Expand Up @@ -536,31 +536,31 @@ typename PointMatcher<T>::OutlierWeights OutlierFiltersImpl<T>::RobustOutlierFil
}
iteration++;

Matrix dists = distanceType == "point2point" ? input.dists : computePointToPlanDistance(filteredReading, filteredReference, input);
Matrix dists = distanceType == "point2point" ? input.dists : computePointToPlaneDistance(filteredReading, filteredReference, input);

// e² = scaled squared distance
Array e2 = dists.array() / (scale * scale);

T k = tuning;
const T k2 = k * k;
Array w, aboveThres, bellowThres;
Array w, aboveThres, belowThres;
switch (robustFctId) {
case RobustFctId::Cauchy: // 1/(1 + e²/k²)
w = (1 + e2 / k2).inverse();
break;
case RobustFctId::Welsch: // exp(-e²/k²)
w = (-e2 / k2).exp();
break;
case RobustFctId::SwitchableConstraint: // if e² > k² then 4 * k²/(k + e²)²
case RobustFctId::SwitchableConstraint: // if e² > k then 4 * k²/(k + e²)²
aboveThres = 4.0 * k2 * ((k + e2).square()).inverse();
w = (e2 >= k).select(aboveThres, 1.0);
break;
case RobustFctId::GM: // k²/(k + e²)²
w = k2*((k + e2).square()).inverse();
break;
case RobustFctId::Tukey: // if e² < k then (1-e²/k²)²
bellowThres = (1 - e2 / k2).square();
w = (e2 >= k2).select(0.0, bellowThres);
case RobustFctId::Tukey: // if e² < k² then (1-e²/k²)²
belowThres = (1 - e2 / k2).square();
w = (e2 >= k2).select(0.0, belowThres);
break;
case RobustFctId::Huber: // if |e| >= k then k/|e| = k/sqrt(e²)
aboveThres = k * (e2.sqrt().inverse());
Expand Down
2 changes: 1 addition & 1 deletion pointmatcher/OutlierFiltersImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ struct OutlierFiltersImpl
;
}

Matrix computePointToPlanDistance(const DataPoints& filteredReading, const DataPoints& filteredReference, const Matches& input);
Matrix computePointToPlaneDistance(const DataPoints& filteredReading, const DataPoints& filteredReference, const Matches& input);
virtual OutlierWeights compute(const DataPoints& filteredReading, const DataPoints& filteredReference, const Matches& input);
RobustOutlierFilter(const std::string& className, const ParametersDoc paramsDoc, const Parameters& params);
RobustOutlierFilter(const Parameters& params = Parameters());
Expand Down

0 comments on commit 660a72b

Please sign in to comment.