use a stricter tolerance to check for equal points

add method IsEqual to Vector3 class to support user-defined tolerance
This commit is contained in:
wmayer
2016-08-15 14:09:26 +02:00
parent e2345374ca
commit aea769af3d
9 changed files with 70 additions and 28 deletions

View File

@@ -191,7 +191,7 @@ private:
bool ok;
Base::Vector3d dir = this->getUserDirection(&ok);
if (ok) {
if (dir.Length() < FLT_EPSILON) {
if (dir.Length() < Base::Vector3d::epsilon()) {
QMessageBox::critical(this, LocationDialog::tr("Wrong direction"),
LocationDialog::tr("Direction must not be the null vector"));
return;
@@ -304,7 +304,7 @@ public:
public:
void setDirection(const Base::Vector3d& dir)
{
if (dir.Length() < FLT_EPSILON) {
if (dir.Length() < Base::Vector3d::epsilon()) {
return;
}
@@ -336,7 +336,7 @@ public:
bool ok;
Base::Vector3d dir = dlg->getUserDirection(&ok);
if (ok) {
if (dir.Length() < FLT_EPSILON) {
if (dir.Length() < Base::Vector3d::epsilon()) {
QMessageBox::critical(dlg, LocationDialog::tr("Wrong direction"),
LocationDialog::tr("Direction must not be the null vector"));
return false;