Skip to content

Commit

Permalink
release 0.8.1 Qt5 support, formatting, fix all compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMcCrae committed Dec 8, 2024
1 parent 47f1c28 commit b4900b9
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 105 deletions.
14 changes: 7 additions & 7 deletions include/physics.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class CJoint
int irb0; // id of rigid body
int irb1; // id of rigid body
////
double jp0[4]; // joint position
double jp1[4]; // joint position
double jp0[4] = {}; // joint position
double jp1[4] = {}; // joint position
////
CVector3D linear;
CVector3D torque;
Expand All @@ -91,7 +91,7 @@ class CPlateSection
double length;
////
double r, g, b;
double weakness; // stress scaled with breaking stress
double weakness = {}; // stress scaled with breaking stress
CVector3D ltrq;
};

Expand All @@ -118,9 +118,9 @@ class CPlate
bool is_trq;
CVector3D ltrq;
////
bool is_boundary;
int iedge0;
double ratio_edge0;
bool is_boundary = {};
int iedge0 = {};
double ratio_edge0 = {};
};
std::vector<CLocalForce> alForce; // local force
std::vector<CPlateSection> aPS; // plate section
Expand Down Expand Up @@ -321,7 +321,7 @@ class CPhysics
const std::vector<double>& aDir2D,
const int nH, const double max_stress);

static void AddWeakWection_Slit(CPlate& plt, // (in,out)
static void AddWeakSection_Slit(CPlate& plt, // (in,out)
////
const std::vector<double>& aXY,
const CRigidBody& rb,
Expand Down
2 changes: 1 addition & 1 deletion include/pivotcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class PivotCamera
QVector3D lookat;

bool interp_active;
QTime interp_time;
QElapsedTimer interp_time;
float interp_duration;

// what is needed for interpolation
Expand Down
6 changes: 3 additions & 3 deletions src/beziercurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ void BezierCurve::GetLineIntersections(const QVector2D & line_p, const QVector2D
for (int j=i+1; j<intersects.size(); ++j) {

if (QVector2D::dotProduct(intersects[i].point, line_d) > QVector2D::dotProduct(intersects[j].point, line_d)) {
intersects.swap(i, j);
intersects.swapItemsAt(i, j);
}

}
Expand Down Expand Up @@ -1219,11 +1219,11 @@ float BezierCurve::Length() const
void BezierCurve::Reverse()
{
for(int i = 0; i < (pts.size()/2); i++) {
pts.swap(i, pts.size()-(1+i));
pts.swapItemsAt(i, pts.size()-(1+i));
}

for(int i = 0; i < (samples.size()/2); i++) {
samples.swap(i, samples.size()-(1+i));
samples.swapItemsAt(i, samples.size()-(1+i));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/glwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3536,7 +3536,7 @@ void GLWidget::LoadTemplateOBJ()

while (!ifs.atEnd()) {
const QStringList line =
ifs.readLine().split(" ", QString::SkipEmptyParts);
ifs.readLine().split(" ", Qt::SkipEmptyParts);

// skip any blank lines or lines without at least 4 entries (a command +
// 3 parameters)
Expand Down Expand Up @@ -6186,7 +6186,7 @@ void GLWidget::DoPhysicsTest()
// TODO/NOTE: physics expects everything in m (metres)

// first add each rigid body
double total_mass = 0.0;
// double total_mass = 0.0;
for (int i = 0; i < sections.size(); ++i) {
QVector3D mass_cent = sections[i].GetCentroid3D(); // centre of mass
// double mass = fabsf(sections[i].SignedArea()) *
Expand All @@ -6196,7 +6196,7 @@ void GLWidget::DoPhysicsTest()
fabs(sections[i].SignedArea() * metres_per_unit * metres_per_unit) *
sections[i].SlabThickness() * metres_per_unit;

total_mass += mass;
// total_mass += mass;

double mass_cent_array[3];
mass_cent_array[0] = mass_cent.x() * metres_per_unit;
Expand Down
7 changes: 5 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
MainWindow::MainWindow()
{
// title/window stuff
window_title = "FlatFab 0.8.0 (beta)";
window_title = "FlatFab 0.8.1";
setWindowTitle(window_title);

// release 0.8.1
// modernize for Qt5, formatting, fix all compiler warnings

// release 0.8.0
// added initial support for finger joints for the surface facet generation
// (teeth between adjacent faces) added ability to export slab geometry as a
Expand Down Expand Up @@ -116,7 +119,7 @@ void MainWindow::ShowWelcomePage()
bottomWidget->setLayout(layout);

bottomDockWidget = new QDockWidget();
bottomDockWidget->setFeatures(0);
bottomDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
bottomDockWidget->setWindowTitle("Start using FlatFab:");
bottomDockWidget->setWidget(bottomWidget);

Expand Down
Loading

0 comments on commit b4900b9

Please sign in to comment.