From 9ef21a2dc91a7e646c3839d999732a2c7a290b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Oudin?= Date: Fri, 9 Feb 2018 20:23:06 +0100 Subject: [PATCH] Update spheroid if conflict with a plan at a given height. --- spheroid.cpp | 8 ++++++++ spheroid.hpp | 1 + 2 files changed, 9 insertions(+) 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)