keep track of initial radius, for deformation
This commit is contained in:
parent
19cb1eb343
commit
0f70e4e023
2 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
||||||
#include "spheroid.hpp"
|
#include "spheroid.hpp"
|
||||||
|
|
||||||
Spheroid::Spheroid(Point& _center, size_t _p, size_t _q) :
|
Spheroid::Spheroid(Point& _center, size_t _p, size_t _q) :
|
||||||
ImplicitSurface(_center), p(_p), q(_q), stiffness(0) {
|
ImplicitSurface(_center), init_p(_p), p(_p), q(_q), stiffness(0) {
|
||||||
_compute_volume();
|
_compute_volume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ void Spheroid::update_center_pos(Point& _center) {
|
||||||
|
|
||||||
void Spheroid::check_horizontal_plan_collision(double& height) {
|
void Spheroid::check_horizontal_plan_collision(double& height) {
|
||||||
if ((center.z - p) <= height) {
|
if ((center.z - p) <= height) {
|
||||||
p = center.z-height;
|
p = fmin(init_p, center.z-height);
|
||||||
update_radius();
|
update_radius();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Spheroid : public ImplicitSurface {
|
||||||
* V is the volume. Extremely useful to have a constant volume in the
|
* V is the volume. Extremely useful to have a constant volume in the
|
||||||
* ball
|
* ball
|
||||||
**/
|
**/
|
||||||
double p, q;
|
double init_p, p, q;
|
||||||
size_t stiffness;
|
size_t stiffness;
|
||||||
double V;
|
double V;
|
||||||
void _compute_volume();
|
void _compute_volume();
|
||||||
|
|
Loading…
Reference in a new issue