39 lines
943 B
C++
39 lines
943 B
C++
#include <string>
|
|
using namespace std;
|
|
|
|
#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 {
|
|
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);
|
|
Vektor lieferePosition();
|
|
Vektor liefereGeschwindigkeit();
|
|
void bewegen(Vektor beschleunigung, float dt);
|
|
};
|