64 lines
1.6 KiB
C++
64 lines
1.6 KiB
C++
#include <string>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include "flugkurve03.h"
|
|
using namespace std;
|
|
|
|
|
|
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 Vektor::ausgabeVektor(const Vektor &vec){
|
|
|
|
}
|
|
|
|
/*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;
|
|
|
|
// Ermittlung der neuen Geschwindigkeit
|
|
erg.geschwindigkeit.x = korp.geschwindigkeit.x + dt * xBeschleunigung;
|
|
erg.geschwindigkeit.y = korp.geschwindigkeit.y + dt * yBeschleunigung;
|
|
|
|
// 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;
|
|
}*/
|
|
|
|
float Koerper::liefereMasse()
|
|
{
|
|
return this->masse;
|
|
}
|
|
|
|
Koerper Koerper::bewegeKoerper(const Koerper &korp, const Vektor &gesamtkraft, const float &dt)
|
|
{
|
|
this->geschwindigkeit.x += gesamtkraft.x * dt;
|
|
this->geschwindigkeit.y += gesamtkraft.y * dt;
|
|
this->position.x += this->geschwindigkeit.x * dt;
|
|
this->position.y += this->geschwindigkeit.y * dt;
|
|
}
|
|
|
|
Vektor Koerper::lieferePosition()
|
|
{
|
|
return this->position;
|
|
}
|
|
|
|
Vektor Koerper::liefereGeschwindigkeit()
|
|
{
|
|
return this->geschwindigkeit;
|
|
}
|
|
|
|
string Koerper::text()
|
|
{
|
|
return string();
|
|
}
|