Merge branch 'main' into A6
This commit is contained in:
commit
187ccdc6a5
BIN
5_Flugkurve03/code/flugkurve03
Executable file
BIN
5_Flugkurve03/code/flugkurve03
Executable file
Binary file not shown.
@ -15,27 +15,28 @@ void Vektor::add(const Vektor &vec2) {
|
||||
this->y += vec2.y;
|
||||
}
|
||||
|
||||
Koerper bewegeKoerper(const Koerper &korp, const Vektor &gesamtkraft,const float &dt) {
|
||||
Koerper erg = {0, {0,0}, {0,0}};
|
||||
// Berechnung der Beschleunigung aus der Kraft
|
||||
const float xBeschleunigung = gesamtkraft.x / korp.masse;
|
||||
const float yBeschleunigung = gesamtkraft.y / korp.masse;
|
||||
|
||||
void Koerper::bewegen(const Vektor &beschleunigung,const float &dt) {
|
||||
// Ermittlung der neuen Geschwindigkeit
|
||||
erg.geschwindigkeit.x = korp.geschwindigkeit.x + dt * xBeschleunigung;
|
||||
erg.geschwindigkeit.y = korp.geschwindigkeit.y + dt * yBeschleunigung;
|
||||
this->geschwindigkeit.x += dt * beschleunigung.x;
|
||||
this->geschwindigkeit.y += dt * beschleunigung.y;
|
||||
|
||||
// Ermittlung der neuen Position
|
||||
erg.position.x += korp.position.x + dt * erg.geschwindigkeit.x;
|
||||
erg.position.y += korp.position.y + dt * erg.geschwindigkeit.y;
|
||||
return erg;
|
||||
this->position.x += dt * this->geschwindigkeit.x ;
|
||||
this->position.y += dt * this->geschwindigkeit.y ;
|
||||
}
|
||||
|
||||
void ausgabeKoerper(const Koerper &korp){
|
||||
cout << "x = " << korp.position.x << "y = " << korp.position.y;
|
||||
float Koerper::liefereMasse(){
|
||||
return this->masse;
|
||||
}
|
||||
|
||||
void ausgabeVektor(const Vektor &vec){
|
||||
cout << "x = " << vec.x << endl;
|
||||
cout << "y = " << vec.y << endl;
|
||||
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();
|
||||
}
|
||||
|
||||
@ -19,20 +19,18 @@ public:
|
||||
};
|
||||
// Körper:
|
||||
class Koerper {
|
||||
public:
|
||||
float masse; // [kg]
|
||||
Vektor position;
|
||||
Vektor geschwindigkeit;
|
||||
|
||||
public:
|
||||
Koerper(float masse, Vektor position, Vektor geschwindigkeit) {
|
||||
this->masse = masse;
|
||||
this->position = position;
|
||||
this->geschwindigkeit = geschwindigkeit;
|
||||
};
|
||||
float liefereMasse();
|
||||
Koerper bewegeKoerper(const Koerper &korp, const Vektor &gesamtkraft, const float &dt);
|
||||
void bewegen(const Vektor &gesamtkraft, const float &dt);
|
||||
Vektor lieferePosition();
|
||||
Vektor liefereGeschwindigkeit();
|
||||
void bewegen(Vektor beschleunigung, float dt);
|
||||
string text();
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user