diff --git a/modules/geom/src/vecmat3_op.cc b/modules/geom/src/vecmat3_op.cc index 8ef740e3769afc4d967696d1a0e88eca11c9ad08..4c6a2732a70ecb9f02b0325300bd534aaa64e7fb 100644 --- a/modules/geom/src/vecmat3_op.cc +++ b/modules/geom/src/vecmat3_op.cc @@ -95,7 +95,10 @@ Real Det(const Mat3& m) Real Angle(const Vec3& v1, const Vec3& v2) { - return std::acos(Dot(Normalize(v1), Normalize(v2))); + Real dot_product = Dot(Normalize(v1), Normalize(v2)); + dot_product=std::max(static_cast<Real>(-1.0),dot_product); + dot_product=std::min(static_cast<Real>(1.0),dot_product); + return std::acos(dot_product); } Mat3 EulerTransformation(Real theta, Real phi, Real xi)