diff --git a/spheroid.cpp b/spheroid.cpp index 37089d7..39b77e6 100644 --- a/spheroid.cpp +++ b/spheroid.cpp @@ -26,3 +26,11 @@ void Spheroid::update_radius() { void Spheroid::update_center_pos(Point& _center) { center = _center; } + +void Spheroid::check_plan_collision(double& height) { + if ((center.z - p) <= height) { + p = center.z-height; + update_radius(); + } +} + diff --git a/spheroid.hpp b/spheroid.hpp index 2982f44..92e2efb 100644 --- a/spheroid.hpp +++ b/spheroid.hpp @@ -16,6 +16,7 @@ class Spheroid : public ImplicitSurface { void update_center_pos(Point& _center); void update_radius(); void set_stiffness(size_t _stiffness); + void check_plan_collision(double& height); double operator() (double _x, double _y, double _z) { return (pow(_x - center.x, 2) / pow(q, 2) + pow(_y - center.y, 2) / pow(q, 2)