Add tolerance parm to checkParallel

This commit is contained in:
WandererFan
2017-06-13 10:31:10 -04:00
committed by wmayer
parent ed73fb6e72
commit f53a3bde8f
2 changed files with 3 additions and 3 deletions

View File

@@ -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;

View File

@@ -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,