Compare commits
4 Commits
a7a85287d0
...
cf97b0ac1e
| Author | SHA1 | Date | |
|---|---|---|---|
| cf97b0ac1e | |||
| fada2730bf | |||
| b636977ccd | |||
| 09c8ca75fe |
BIN
5_Flugkurve03/code/flugkurve03
Executable file
BIN
5_Flugkurve03/code/flugkurve03
Executable file
Binary file not shown.
@ -4,4 +4,39 @@
|
|||||||
#include "flugkurve03.h"
|
#include "flugkurve03.h"
|
||||||
using namespace std;
|
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();
|
||||||
|
}
|
||||||
|
|||||||
@ -1,4 +1,36 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
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();
|
||||||
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user