diff --git a/Ball.cpp b/Ball.cpp index 0ded1f3..a2e3705 100644 --- a/Ball.cpp +++ b/Ball.cpp @@ -1,4 +1,5 @@ #include "Ball.hpp" +#include #include Ball::Ball(Point& _center, double _v_x, double _p, double _q) : @@ -52,3 +53,11 @@ void Ball::update_pos(double dt) { } _compute_pos(dt); } + +std::ostream& operator<< (std::ostream &out, Ball const& data) { + Point center = data.getCenter(); + out << center.x << ':'; + out << center.y << ':'; + out << center.z << '\n'; + return out; +} diff --git a/Ball.hpp b/Ball.hpp index 383979d..39a3dd0 100644 --- a/Ball.hpp +++ b/Ball.hpp @@ -9,7 +9,7 @@ * each bounce, which is a reasonable assumption since it is the same for the * vertical bounces. **/ - +#pragma once #include #include "spheroid.hpp" @@ -33,4 +33,7 @@ class Ball { public: Ball(Point& _center, double _v_x, double p, double q); void update_pos(double dt); + Point getCenter() const {return Center;} }; + +std::ostream& operator << (std::ostream &out, Ball const& data);