Modify error message to be more descriptive.
parent
6d842ab117
commit
31ad107053
|
@ -77,7 +77,7 @@ double dot(const Point3 &p, const Point3 &q, OptionalJacobian<1, 3> H1,
|
||||||
|
|
||||||
Point3Pair mean(const std::vector<Point3Pair> &abPointPairs) {
|
Point3Pair mean(const std::vector<Point3Pair> &abPointPairs) {
|
||||||
const size_t n = abPointPairs.size();
|
const size_t n = abPointPairs.size();
|
||||||
if (n == 0) throw std::invalid_argument("input should have at least 1 pair of points");
|
if (n == 0) throw std::invalid_argument("Point3::mean input Point3Pair vector is empty");
|
||||||
Point3 aCentroid(0, 0, 0), bCentroid(0, 0, 0);
|
Point3 aCentroid(0, 0, 0), bCentroid(0, 0, 0);
|
||||||
for (const Point3Pair &abPair : abPointPairs) {
|
for (const Point3Pair &abPair : abPointPairs) {
|
||||||
aCentroid += abPair.first;
|
aCentroid += abPair.first;
|
||||||
|
|
|
@ -62,7 +62,7 @@ GTSAM_EXPORT double dot(const Point3& p, const Point3& q,
|
||||||
/// mean
|
/// mean
|
||||||
template <class CONTAINER>
|
template <class CONTAINER>
|
||||||
GTSAM_EXPORT Point3 mean(const CONTAINER& points) {
|
GTSAM_EXPORT Point3 mean(const CONTAINER& points) {
|
||||||
if (points.size() == 0) throw std::invalid_argument("input should have at least 1 point");
|
if (points.size() == 0) throw std::invalid_argument("Point3::mean input container is empty");
|
||||||
Point3 sum(0, 0, 0);
|
Point3 sum(0, 0, 0);
|
||||||
sum = std::accumulate(points.begin(), points.end(), sum);
|
sum = std::accumulate(points.begin(), points.end(), sum);
|
||||||
return sum / points.size();
|
return sum / points.size();
|
||||||
|
|
Loading…
Reference in New Issue