Showed compiler that B_ is always initialized
parent
a34a9b8ff1
commit
767c5d41ee
|
@ -74,17 +74,15 @@ const Matrix32& Unit3::basis(OptionalJacobian<6, 2> H) const {
|
||||||
tbb::mutex::scoped_lock lock(B_mutex_);
|
tbb::mutex::scoped_lock lock(B_mutex_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Return cached basis if available and the Jacobian isn't needed.
|
|
||||||
if (B_ && !H) {
|
if (B_ && !H) {
|
||||||
|
// Return cached basis if available and the Jacobian isn't needed.
|
||||||
return *B_;
|
return *B_;
|
||||||
}
|
} else if (B_ && H && H_B_) {
|
||||||
|
|
||||||
// Return cached basis and derivatives if available.
|
// Return cached basis and derivatives if available.
|
||||||
if (B_ && H && H_B_) {
|
|
||||||
*H = *H_B_;
|
*H = *H_B_;
|
||||||
return *B_;
|
return *B_;
|
||||||
}
|
} else {
|
||||||
|
B_.reset(Matrix32());
|
||||||
// Get the unit vector and derivative wrt this.
|
// Get the unit vector and derivative wrt this.
|
||||||
// NOTE(hayk): We can't call point3(), because it would recursively call basis().
|
// NOTE(hayk): We can't call point3(), because it would recursively call basis().
|
||||||
const Point3 n(p_);
|
const Point3 n(p_);
|
||||||
|
@ -113,7 +111,6 @@ const Matrix32& Unit3::basis(OptionalJacobian<6, 2> H) const {
|
||||||
Point3 b2 = gtsam::cross(n, b1, H ? &H_b2_n : nullptr, H ? &H_b2_b1 : nullptr);
|
Point3 b2 = gtsam::cross(n, b1, H ? &H_b2_n : nullptr, H ? &H_b2_b1 : nullptr);
|
||||||
|
|
||||||
// Create the basis by stacking b1 and b2.
|
// Create the basis by stacking b1 and b2.
|
||||||
B_.reset(Matrix32());
|
|
||||||
(*B_) << b1.x(), b2.x(), b1.y(), b2.y(), b1.z(), b2.z();
|
(*B_) << b1.x(), b2.x(), b1.y(), b2.y(), b1.z(), b2.z();
|
||||||
|
|
||||||
if (H) {
|
if (H) {
|
||||||
|
@ -130,6 +127,7 @@ const Matrix32& Unit3::basis(OptionalJacobian<6, 2> H) const {
|
||||||
|
|
||||||
return *B_;
|
return *B_;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Point3 Unit3::point3(OptionalJacobian<3, 2> H) const {
|
Point3 Unit3::point3(OptionalJacobian<3, 2> H) const {
|
||||||
|
|
Loading…
Reference in New Issue