+ fix issue with bad default value of natural direction
This commit is contained in:
parent
a869033925
commit
18f1cf7821
|
@ -52,7 +52,7 @@ ConstraintForce::ConstraintForce()
|
||||||
"Points where arrows are drawn");
|
"Points where arrows are drawn");
|
||||||
ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3d(0,0,1)),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
ADD_PROPERTY_TYPE(DirectionVector,(Base::Vector3d(0,0,1)),"ConstraintForce",App::PropertyType(App::Prop_ReadOnly|App::Prop_Output),
|
||||||
"Direction of arrows");
|
"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<Base::Vector3d>());
|
Points.setValues(std::vector<Base::Vector3d>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ void ConstraintForce::onChanged(const App::Property* prop)
|
||||||
std::vector<Base::Vector3d> normals;
|
std::vector<Base::Vector3d> normals;
|
||||||
if (getPoints(points, normals)) {
|
if (getPoints(points, normals)) {
|
||||||
Points.setValues(points); // We don't use the normals because all arrows should have the same direction
|
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) {
|
} else if (prop == &Direction) {
|
||||||
Base::Vector3d direction = getDirection(Direction);
|
Base::Vector3d direction = getDirection(Direction);
|
||||||
|
@ -82,14 +81,13 @@ void ConstraintForce::onChanged(const App::Property* prop)
|
||||||
if (Reversed.getValue())
|
if (Reversed.getValue())
|
||||||
direction = -direction;
|
direction = -direction;
|
||||||
DirectionVector.setValue(direction);
|
DirectionVector.setValue(direction);
|
||||||
DirectionVector.touch();
|
|
||||||
} else if (prop == &Reversed) {
|
} else if (prop == &Reversed) {
|
||||||
if (Reversed.getValue() && (DirectionVector.getValue() == naturalDirectionVector)) {
|
if (naturalDirectionVector.Length() >= Precision::Confusion()) {
|
||||||
DirectionVector.setValue(-naturalDirectionVector);
|
if (Reversed.getValue() && (DirectionVector.getValue() == naturalDirectionVector)) {
|
||||||
DirectionVector.touch();
|
DirectionVector.setValue(-naturalDirectionVector);
|
||||||
} else if (!Reversed.getValue() && (DirectionVector.getValue() != naturalDirectionVector)) {
|
} else if (!Reversed.getValue() && (DirectionVector.getValue() != naturalDirectionVector)) {
|
||||||
DirectionVector.setValue(naturalDirectionVector);
|
DirectionVector.setValue(naturalDirectionVector);
|
||||||
DirectionVector.touch();
|
}
|
||||||
}
|
}
|
||||||
} else if (prop == &NormalDirection) {
|
} else if (prop == &NormalDirection) {
|
||||||
// Set a default direction if no direction reference has been given
|
// Set a default direction if no direction reference has been given
|
||||||
|
|
Loading…
Reference in New Issue
Block a user