Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+69
@@ -0,0 +1,69 @@
|
||||
#include <QApplication>
|
||||
#include "ballistiksimulator.h"
|
||||
#include "trajectorywarp.h"
|
||||
#include "trajectorywidget.h"
|
||||
#include <QtMath>
|
||||
|
||||
|
||||
|
||||
Curve trajectoryPointsToCurve(const QVector<TrajectoryPoint>& trajectory,
|
||||
const QVector3D& color)
|
||||
{
|
||||
Curve curve;
|
||||
curve.color = color;
|
||||
|
||||
curve.points.reserve(trajectory.size());
|
||||
for (const auto& p : trajectory) {
|
||||
curve.points.append(p.position);
|
||||
}
|
||||
|
||||
return curve;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
|
||||
BallistikSimulator sim;
|
||||
|
||||
double v0 = 400.0;
|
||||
double winkel = 20.0;
|
||||
double masse = 0.015;
|
||||
double cw = 0.29;
|
||||
double flaeche = 0.00006;
|
||||
double praezision = 0.2;
|
||||
|
||||
QVector<TrajectoryPoint> original = sim.simuliereFlug(v0, winkel, masse, cw, flaeche, praezision);
|
||||
|
||||
sim.speichereInCSV(0,original, "flugbahn.csv");
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
TrajectoryWidget widget;
|
||||
widget.resize(800, 600);
|
||||
widget.setWindowTitle("3D Trajectory Viewer");
|
||||
|
||||
QVector3D originalTarget = original.last().position;
|
||||
|
||||
// Ziel streuen
|
||||
QVector3D newTarget = originalTarget + QVector3D( 5.0, 5.0, 5.0);
|
||||
|
||||
auto warped = TrajectoryWarp::warpToNewTarget(original, newTarget);
|
||||
|
||||
sim.speichereInCSV(1,warped, "flugbahn.csv");
|
||||
|
||||
// Kurve 1
|
||||
Curve c1 = trajectoryPointsToCurve(original, QVector3D(1, 1, 0));
|
||||
|
||||
// Kurve 2
|
||||
Curve c2 = trajectoryPointsToCurve(warped, QVector3D(0, 1, 1));
|
||||
|
||||
QVector<Curve> curves;
|
||||
curves.append(c1);
|
||||
curves.append(c2);
|
||||
widget.setCurves(curves);
|
||||
widget.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in new issue
Block a user