FEM: Use std::numeric_limits and std::numbers instead of defines
This commit is contained in:
@@ -66,6 +66,8 @@ bool ViewProviderFemConstraintPulley::setEdit(int ModNum)
|
||||
|
||||
void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
{
|
||||
using std::numbers::pi;
|
||||
|
||||
// Gets called whenever a property of the attached object changes
|
||||
Fem::ConstraintPulley* pcConstraint = this->getObject<Fem::ConstraintPulley>();
|
||||
|
||||
@@ -82,7 +84,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
@@ -106,9 +108,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2),
|
||||
SbVec3f(sin(forceAngle + beltAngle + pi / 2),
|
||||
0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
cos(forceAngle + beltAngle + pi / 2))));
|
||||
GuiTools::createPlacement(sep, SbVec3f(0, dia / 8 + dia / 2 * rat1, 0), SbRotation());
|
||||
sep->addChild(GuiTools::createArrow(dia / 8 + dia / 2 * rat1, dia / 8));
|
||||
pShapeSep->addChild(sep); // child 3
|
||||
@@ -118,9 +120,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - pi / 2),
|
||||
0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
-cos(forceAngle - beltAngle - pi / 2))));
|
||||
GuiTools::createPlacement(sep, SbVec3f(0, dia / 8 + dia / 2 * rat2, 0), SbRotation());
|
||||
sep->addChild(GuiTools::createArrow(dia / 8 + dia / 2 * rat2, dia / 8));
|
||||
pShapeSep->addChild(sep); // child 4
|
||||
@@ -134,7 +136,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
@@ -153,9 +155,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2),
|
||||
SbVec3f(sin(forceAngle + beltAngle + pi / 2),
|
||||
0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
cos(forceAngle + beltAngle + pi / 2))));
|
||||
GuiTools::updatePlacement(sep,
|
||||
2,
|
||||
SbVec3f(0, dia / 8 + dia / 2 * rat1, 0),
|
||||
@@ -169,9 +171,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - pi / 2),
|
||||
0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
-cos(forceAngle - beltAngle - pi / 2))));
|
||||
GuiTools::updatePlacement(sep,
|
||||
2,
|
||||
SbVec3f(0, dia / 8 + dia / 2 * rat2, 0),
|
||||
@@ -187,7 +189,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
|
||||
const SoSeparator* sep = static_cast<SoSeparator*>(pShapeSep->getChild(3));
|
||||
@@ -197,9 +199,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2),
|
||||
SbVec3f(sin(forceAngle + beltAngle + pi / 2),
|
||||
0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
cos(forceAngle + beltAngle + pi / 2))));
|
||||
sep = static_cast<SoSeparator*>(pShapeSep->getChild(4));
|
||||
GuiTools::updatePlacement(sep,
|
||||
0,
|
||||
@@ -207,9 +209,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - pi / 2),
|
||||
0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
-cos(forceAngle - beltAngle - pi / 2))));
|
||||
}
|
||||
}
|
||||
else if ((prop == &pcConstraint->BeltForce1) || (prop == &pcConstraint->BeltForce2)) {
|
||||
|
||||
Reference in New Issue
Block a user