56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
#include <string>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include "flugkurve03.h"
|
|
using namespace std;
|
|
|
|
Vektor Vektor::mul(const float &skalar)
|
|
{
|
|
this->x *= skalar;
|
|
this->y *= skalar;
|
|
|
|
return *this;
|
|
}
|
|
|
|
Vektor Vektor::add(const Vektor &vektor_to_add)
|
|
{
|
|
this->x += vektor_to_add.x;
|
|
this->y += vektor_to_add.y;
|
|
|
|
return *this;
|
|
}
|
|
|
|
Koerper Koerper::bewegen(const Vektor &beschleunigung, const float &dt)
|
|
{
|
|
this->position.x += this->geschwindigkeit.x * dt;
|
|
this->position.y += this->geschwindigkeit.y * dt;
|
|
|
|
this->geschwindigkeit.x += beschleunigung.x * dt;
|
|
this->geschwindigkeit.y += beschleunigung.y * dt;
|
|
|
|
return *this;
|
|
}
|
|
|
|
Vektor Koerper::liefereGeschwindigkeit()
|
|
{
|
|
return this->geschwindigkeit;
|
|
}
|
|
|
|
Vektor Koerper::lieferePosition()
|
|
{
|
|
return this->position;
|
|
}
|
|
|
|
float Koerper::liefereMasse()
|
|
{
|
|
return this->masse;
|
|
}
|
|
|
|
string Koerper::text()
|
|
{
|
|
stringstream ausgabe;
|
|
|
|
ausgabe << "(" << this->position.x << "," << this->position.y << ")";
|
|
|
|
return ausgabe.str();
|
|
} |