Add tolerance parm to checkParallel
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user