From f53a3bde8f5cfb3f3a54daed2e92f84a9d08fa08 Mon Sep 17 00:00:00 2001 From: WandererFan Date: Tue, 13 Jun 2017 10:31:10 -0400 Subject: [PATCH] Add tolerance parm to checkParallel --- src/Mod/TechDraw/App/DrawUtil.cpp | 4 ++-- src/Mod/TechDraw/App/DrawUtil.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawUtil.cpp b/src/Mod/TechDraw/App/DrawUtil.cpp index d65d2cce5b..f89b085ac6 100644 --- a/src/Mod/TechDraw/App/DrawUtil.cpp +++ b/src/Mod/TechDraw/App/DrawUtil.cpp @@ -319,12 +319,12 @@ Base::Vector3d DrawUtil::toR3(const gp_Ax2 fromSystem, const Base::Vector3d from } //! check if two vectors are parallel -bool DrawUtil::checkParallel(const Base::Vector3d v1, Base::Vector3d v2) +bool DrawUtil::checkParallel(const Base::Vector3d v1, Base::Vector3d v2, double tolerance) { bool result = false; double dot = fabs(v1.Dot(v2)); double mag = v1.Length() * v2.Length(); - if (DrawUtil::fpCompare(dot,mag)) { + if (DrawUtil::fpCompare(dot,mag,tolerance)) { result = true; } return result; diff --git a/src/Mod/TechDraw/App/DrawUtil.h b/src/Mod/TechDraw/App/DrawUtil.h index 70e0844759..400380c127 100644 --- a/src/Mod/TechDraw/App/DrawUtil.h +++ b/src/Mod/TechDraw/App/DrawUtil.h @@ -65,7 +65,7 @@ class TechDrawExport DrawUtil { static std::string formatVector(const Base::Vector2d& v); static bool vectorLess(const Base::Vector3d& v1, const Base::Vector3d& v2); static Base::Vector3d toR3(const gp_Ax2 fromSystem, const Base::Vector3d fromPoint); - static bool checkParallel(const Base::Vector3d v1, const Base::Vector3d v2); + static bool checkParallel(const Base::Vector3d v1, const Base::Vector3d v2, double tolerance = FLT_EPSILON); //! rotate vector by angle radians around axis through org static Base::Vector3d vecRotate(Base::Vector3d vec, double angle,