Update spheroid if conflict with a plan at a given height.
This commit is contained in:
parent
bf3232d790
commit
9ef21a2dc9
2 changed files with 9 additions and 0 deletions
|
@ -26,3 +26,11 @@ void Spheroid::update_radius() {
|
||||||
void Spheroid::update_center_pos(Point& _center) {
|
void Spheroid::update_center_pos(Point& _center) {
|
||||||
center = _center;
|
center = _center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Spheroid::check_plan_collision(double& height) {
|
||||||
|
if ((center.z - p) <= height) {
|
||||||
|
p = center.z-height;
|
||||||
|
update_radius();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ class Spheroid : public ImplicitSurface {
|
||||||
void update_center_pos(Point& _center);
|
void update_center_pos(Point& _center);
|
||||||
void update_radius();
|
void update_radius();
|
||||||
void set_stiffness(size_t _stiffness);
|
void set_stiffness(size_t _stiffness);
|
||||||
|
void check_plan_collision(double& height);
|
||||||
double operator() (double _x, double _y, double _z) {
|
double operator() (double _x, double _y, double _z) {
|
||||||
return (pow(_x - center.x, 2) / pow(q, 2)
|
return (pow(_x - center.x, 2) / pow(q, 2)
|
||||||
+ pow(_y - center.y, 2) / pow(q, 2)
|
+ pow(_y - center.y, 2) / pow(q, 2)
|
||||||
|
|
Loading…
Reference in a new issue