From 18f1cf78214337a19008b20d1bb942421eb88359 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 20 Feb 2015 14:40:03 +0100 Subject: [PATCH] + fix issue with bad default value of natural direction --- src/Mod/Fem/App/FemConstraintForce.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Mod/Fem/App/FemConstraintForce.cpp b/src/Mod/Fem/App/FemConstraintForce.cpp index 2f55c9c77..f3e5bf4bf 100644 --- a/src/Mod/Fem/App/FemConstraintForce.cpp +++ b/src/Mod/Fem/App/FemConstraintForce.cpp @@ -52,7 +52,7 @@ ConstraintForce::ConstraintForce() "Points where arrows are drawn"); ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3d(0,0,1)),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output), "Direction of arrows"); - naturalDirectionVector = Base::Vector3d(0,0,1); + naturalDirectionVector = Base::Vector3d(0,0,0); // by default use the null vector to indication an invalid value Points.setValues(std::vector()); } @@ -72,7 +72,6 @@ void ConstraintForce::onChanged(const App::Property* prop) std::vector normals; if (getPoints(points, normals)) { Points.setValues(points); // We don't use the normals because all arrows should have the same direction - Points.touch(); // This triggers ViewProvider::updateData() } } else if (prop == &Direction) { Base::Vector3d direction = getDirection(Direction); @@ -82,14 +81,13 @@ void ConstraintForce::onChanged(const App::Property* prop) if (Reversed.getValue()) direction = -direction; DirectionVector.setValue(direction); - DirectionVector.touch(); } else if (prop == &Reversed) { - if (Reversed.getValue() && (DirectionVector.getValue() == naturalDirectionVector)) { - DirectionVector.setValue(-naturalDirectionVector); - DirectionVector.touch(); - } else if (!Reversed.getValue() && (DirectionVector.getValue() != naturalDirectionVector)) { - DirectionVector.setValue(naturalDirectionVector); - DirectionVector.touch(); + if (naturalDirectionVector.Length() >= Precision::Confusion()) { + if (Reversed.getValue() && (DirectionVector.getValue() == naturalDirectionVector)) { + DirectionVector.setValue(-naturalDirectionVector); + } else if (!Reversed.getValue() && (DirectionVector.getValue() != naturalDirectionVector)) { + DirectionVector.setValue(naturalDirectionVector); + } } } else if (prop == &NormalDirection) { // Set a default direction if no direction reference has been given