diff --git a/Ball.cpp b/Ball.cpp index f5b8933..1e24fdc 100644 --- a/Ball.cpp +++ b/Ball.cpp @@ -5,20 +5,20 @@ Ball::Ball(Point& _center, double _min_height, double _v_x, double _p, double _q) : Center(_center), surface(_center, min_height, _p, _q), - init_h(_center.z), + init_h(_center.y), min_height(_min_height), bounce_number(0.0), crt_time(0), - A(_center.z), + A(_center.y), B(0), - U(sqrt(2 * G_CTE * _center.z)), - T(sqrt(2.0 * _center.z / G_CTE)), + U(sqrt(2 * G_CTE * _center.y)), + T(sqrt(2.0 * _center.y / G_CTE)), v_x(_v_x) { } void Ball::_compute_pos(double dt) { - Center.z = fmax(0.0, A + B * crt_time - (G_CTE / 2) * crt_time * crt_time + min_height); + Center.y = fmax(0.0, A + B * crt_time - (G_CTE / 2) * crt_time * crt_time + min_height); Center.x += dt * v_x; surface.update_center_pos(Center); } @@ -66,7 +66,7 @@ std::ostream& operator<< (std::ostream &out, Ball const& data) { out << "t:" << data.access_crt_time() << ":"; out << "T:" << data.accessT() << ":"; out << center.x << ':'; - out << center.y << ':'; out << center.z << ':'; + out << center.y << ':'; return out; } diff --git a/main_ball.cpp b/main_ball.cpp index 00fb7c4..14e6f58 100644 --- a/main_ball.cpp +++ b/main_ball.cpp @@ -10,7 +10,7 @@ using namespace std; int main(int argc, char** argv) { int i; - Point center(0,0,10); + Point center(0,10,0); Ball ball(center, 0, 0.25, 1, 1); for(i=0; i< 10000; i++) { ball.update_pos(0.001); diff --git a/spheroid.cpp b/spheroid.cpp index 7fb8673..1e5be43 100644 --- a/spheroid.cpp +++ b/spheroid.cpp @@ -29,8 +29,8 @@ void Spheroid::update_center_pos(Point& _center) { } void Spheroid::check_horizontal_plan_collision(double& height) { - if ((center.z - p) <= height) { - p = fmin(init_p, center.z-height); + if ((center.y - p) <= height) { + p = fmin(init_p, center.y-height); update_radius(); } }