From eab154fca5ae8cafc38ad3caa2983a65276608dd Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 4 May 2019 22:28:28 +1000 Subject: [PATCH] solved one numerical issue in RotationMatrix --- vcg/math/matrix33.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vcg/math/matrix33.h b/vcg/math/matrix33.h index 3e2f8b4d..9368a9c1 100644 --- a/vcg/math/matrix33.h +++ b/vcg/math/matrix33.h @@ -518,7 +518,14 @@ Matrix33 RotationMatrix(vcg::Point3 v0,vcg::Point3 v1,bool normalized=t rotM.SetIdentity(); return rotM; } - + if (dot<(-(S)1+epsilon)) + { + rotM.SetZero(); + rotM[0][0]=-1; + rotM[1][1]=-1; + rotM[2][2]=-1; + return (rotM); + } ///find the axis of rotation CoordType axis; axis=v0^v1;