Compare commits

...

4 Commits

3 changed files with 69 additions and 2 deletions

BIN
5_Flugkurve03/code/flugkurve03 Executable file

Binary file not shown.

View File

@ -4,4 +4,39 @@
#include "flugkurve03.h"
using namespace std;
//to be implemented
void Vektor::mul(const float &skalar){
this->x *= skalar;
this->y *= skalar;
}
void Vektor::add(const Vektor &vec2) {
this->x += vec2.x;
this->y += vec2.y;
}
void Koerper::bewegen(const Vektor &beschleunigung,const float &dt) {
// Ermittlung der neuen Geschwindigkeit
this->geschwindigkeit.x += dt * beschleunigung.x;
this->geschwindigkeit.y += dt * beschleunigung.y;
// Ermittlung der neuen Position
this->position.x += dt * this->geschwindigkeit.x ;
this->position.y += dt * this->geschwindigkeit.y ;
}
float Koerper::liefereMasse(){
return this->masse;
}
Vektor Koerper::lieferePosition(){
return this->position;
}
Vektor Koerper::liefereGeschwindigkeit(){
return this->geschwindigkeit;
}
string Koerper::text(){
string outputX = to_string(this->position.x);
string outputY = to_string(this->position.y);
stringstream ganzeOut;
ganzeOut << "X= " << outputX << " Y= " << outputY;
return ganzeOut.str();
}

View File

@ -1,4 +1,36 @@
#include <string>
using namespace std;
// to be defined
#pragma once
// Parametrierung der auf den Körper wirkende Kräfte:
class Vektor {
public:
float x; // [m/s^2]
float y; // [m/s^2]
Vektor() = default;
Vektor(float x, float y) {
this->x = x;
this->y = y;
}
void add(const Vektor &vec2);
void ausgabeVektor(const Vektor &vec);
void mul(const float &skalar);
};
// Körper:
class Koerper {
public:
float masse; // [kg]
Vektor position;
Vektor geschwindigkeit;
Koerper(float masse, Vektor position, Vektor geschwindigkeit) {
this->masse = masse;
this->position = position;
this->geschwindigkeit = geschwindigkeit;
};
float liefereMasse();
void bewegen(const Vektor &gesamtkraft, const float &dt);
Vektor lieferePosition();
Vektor liefereGeschwindigkeit();
string text();
};