Changed name to avoid template confusion in VC 2016

release/4.3a0
Frank Dellaert 2020-10-01 11:24:26 -04:00
parent b89478c0fa
commit b9174ae0f4
2 changed files with 7 additions and 9 deletions

View File

@ -75,17 +75,15 @@ double dot(const Point3 &p, const Point3 &q, OptionalJacobian<1, 3> H1,
return p.x() * q.x() + p.y() * q.y() + p.z() * q.z();
}
Point3Pair mean(const std::vector<Point3Pair> &abPointPairs) {
Point3Pair means(const std::vector<Point3Pair> &abPointPairs) {
const size_t n = abPointPairs.size();
Point3 aCentroid(0, 0, 0), bCentroid(0, 0, 0);
Point3 aSum(0, 0, 0), bSum(0, 0, 0);
for (const Point3Pair &abPair : abPointPairs) {
aCentroid += abPair.first;
bCentroid += abPair.second;
aSum += abPair.first;
bSum += abPair.second;
}
const double f = 1.0 / n;
aCentroid *= f;
bCentroid *= f;
return make_pair(aCentroid, bCentroid);
return {aSum * f, bSum * f};
}
/* ************************************************************************* */

View File

@ -67,8 +67,8 @@ GTSAM_EXPORT Point3 mean(const CONTAINER& points) {
return sum / points.size();
}
/// mean of Point3 pair
GTSAM_EXPORT Point3Pair mean(const std::vector<Point3Pair>& abPointPairs);
/// mean of Point3 pair
GTSAM_EXPORT Point3Pair means(const std::vector<Point3Pair> &abPointPairs);
template <typename A1, typename A2>
struct Range;