FEM: Use std::numeric_limits and std::numbers instead of defines

This commit is contained in:
Benjamin Nauck
2025-03-27 19:00:41 +01:00
parent 3fc0831116
commit e2da3bce46
22 changed files with 153 additions and 134 deletions

View File

@@ -756,7 +756,10 @@ void CylinderWidget::radiusChanged(double)
PROPERTY_SOURCE(FemGui::ViewProviderFemPostPlaneFunction, FemGui::ViewProviderFemPostFunction)
// NOTE: The technical lower limit is at 1e-4 that the Coin3D manipulator can handle
static const App::PropertyFloatConstraint::Constraints scaleConstraint = {1e-4, DBL_MAX, 1.0};
static const App::PropertyFloatConstraint::Constraints scaleConstraint = {
1e-4,
std::numeric_limits<double>::max(),
1.0};
ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction()
: m_detectscale(false)
@@ -1178,6 +1181,8 @@ SoGroup* postBox()
SoGroup* postCylinder()
{
using std::numbers::pi;
SoCoordinate3* points = new SoCoordinate3();
int nCirc = 20;
const int nSide = 8;
@@ -1189,8 +1194,8 @@ SoGroup* postCylinder()
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < nCirc + 1; ++j) {
points->point.set1Value(idx,
SbVec3f(std::cos(2 * M_PI / nCirc * j),
std::sin(2 * M_PI / nCirc * j),
SbVec3f(std::cos(2 * pi / nCirc * j),
std::sin(2 * pi / nCirc * j),
-h / 2. + h * i));
++idx;
}
@@ -1199,8 +1204,8 @@ SoGroup* postCylinder()
for (int i = 0; i < nSide; ++i) {
for (int j = 0; j < 2; ++j) {
points->point.set1Value(idx,
SbVec3f(std::cos(2 * M_PI / nSide * i),
std::sin(2 * M_PI / nSide * i),
SbVec3f(std::cos(2 * pi / nSide * i),
std::sin(2 * pi / nSide * i),
-h / 2. + h * j));
++idx;
}
@@ -1243,24 +1248,26 @@ SoGroup* postPlane()
SoGroup* postSphere()
{
using std::numbers::pi;
SoCoordinate3* points = new SoCoordinate3();
points->point.setNum(2 * 84);
int idx = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 21; j++) {
points->point.set1Value(idx,
SbVec3f(std::sin(2 * M_PI / 20 * j) * std::cos(M_PI / 4 * i),
std::sin(2 * M_PI / 20 * j) * std::sin(M_PI / 4 * i),
std::cos(2 * M_PI / 20 * j)));
SbVec3f(std::sin(2 * pi / 20 * j) * std::cos(pi / 4 * i),
std::sin(2 * pi / 20 * j) * std::sin(pi / 4 * i),
std::cos(2 * pi / 20 * j)));
++idx;
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 21; j++) {
points->point.set1Value(idx,
SbVec3f(std::sin(M_PI / 4 * i) * std::cos(2 * M_PI / 20 * j),
std::sin(M_PI / 4 * i) * std::sin(2 * M_PI / 20 * j),
std::cos(M_PI / 4 * i)));
SbVec3f(std::sin(pi / 4 * i) * std::cos(2 * pi / 20 * j),
std::sin(pi / 4 * i) * std::sin(2 * pi / 20 * j),
std::cos(pi / 4 * i)));
++idx;
}
}